Jump to content

PGN Chess BBCode


Recommended Posts

File Name: PGN Chess BBCode

File Submitter: bfarber

File Submitted: 05 Jun 2012

File Category: User and Social Engagement

Supported Versions: IP.Board 3.4.x


  • ipBoard v3.4.x use v1.1.x
  • ipBoard v3.3.x use v1.0.2

BBCode to display PGN chess boards, based on the PGN4WEB system.

In order for the file size to comply with Marketplace restrictions I have had to remove large parts of the additional styling available, to load onto your system read this FAQ entry.

Help FAQ for this click here.

Options in the [pgn] are specifies as [pgn option=value] short commands usable, (* indicates default) options are;
  • height 286* to 512
  • display horizontal* or vertical
  • showmoves figurine*, text, puzzle, hidden
  • initialvariation numeric value default 0
  • initialgame first*, last, random, or a numeric value
  • autoplaymode game*, loop, none
  • initialhalfmove start*, end, random, comment or a numeric value

Example: [pgn h=500 d=v sm=p ihm=e] ... [/pgn]

Sponsored by Telemacus2

BBCode developed by JLogica base API development PGN4Web

here to download this file

Link to comment
Share on other sites

Just to explain this a little further:

PGN Stands for "Portable Game Notation".
This notation uses the "algebraic system" (you know, a chess board with coodinates: letters for files and numbers for ranks. Thanks to this system, each square on the chess board has a name, like e1, b2, c3, etc.).
With this script, you can easily add a chessgame in algebraic notation to a topic, and then a little board will appear and the user will be able to follow the game. It's really cool.
The original pgn4web script is incredibly advanced, allowing puzzles, autoplay, board flip, etc. etc.

What does a chessgame look like in pgn notation?

Like this:

[Event "WC"]
[Site "Moscow"]
[Date "2012.05.25"]
[Round "7"]
[White "Anand"]
[Black "Gelfand"]
[Result "0-1"]
[PlyCount "8"]

1. d4 Nf6 2. Nd2 e5 3. dxe5 Ng4 4. h3 Ne3

All a user needs to do is enter the code between the [pgn] [/pgn] tags.

You need a demo?

Here's a quick one. I might edit this later to show a different game, etc.


Timber: what exactly did you write between the pgn tags? "Agn" is not a chess move.

Link to comment
Share on other sites

It did the same thing and then when I clicked on the rook, this is what came up:

pgn4web: version=2.56 homepage=http://pgn4web.casaschi.net

JSURL: url=http://www.wolfandgoddess.com/forums/public/js/pgn4web/pgn4web.js

PGNTEXT: length=5

GAME: current=1 number=1

VARIATION: current=0 number=0

PLY: start=0 current=0 number=1

AUTOPLAY: status=off delay=3000ms next=false

CUSTOM: autoScroll=true

ALERTLOG: fatalnew=2 new=2 shown=2 total=2


error: invalid ply 1. pgn in game 1 variation 0

Tue Jun 05 2012 22:51:32 GMT+0700 (ICT)


error: invalid ply 1. pgn in game 1 variation 0

Tue Jun 05 2012 22:50:57 GMT+0700 (ICT)


Link to comment
Share on other sites

From reading the message there the information you put between the tags is invalid. Give me the full '[pgn] ???? [/pgn]' to have a look at.

Link to comment
Share on other sites

If you read the help.html file, you'll see that each square on the board actually has a function, and it seems that you clicked on the debug information, and since you didn't enter a valid pgn code, it's showing you what the error is! :smile:
Clicking on the board is not going to move any pieces. Click on the g8 square for the help file.
Also, just try adding some pgn code between the tags, like this: 1.e4 f6 2.d4 g5 3.Qh5

Link to comment
Share on other sites

I also just pulled this off your site:

[pgn h=500 d=v sm=p ihm=e]

[Event "NumNuts"]

[Site "Burraga"]

[Date "2012.10.15"]

[Round "16"]

[White "Oscar"]

[Black "Lucy"]

[Result "0-1"]

1. e4 c5 2. Nf3 e6 3. d4 cxd4 4. Nxd4 Nc6 5. Nb5 d6 6. c4 Nf6 7. N1c3 a6 8.

Na3 d5 9. cxd5 exd5 10. exd5 Nb4 11. Be2 Bc5 12. O-O O-O 13. Bf3 Bf5 14.

Bg5 Re8 15. Qd2 b5 16. Rad1 Nd3 17. Nab1 h6 18. Bh4 b4 19. Na4 Bd6 20. Bg3

Rc8 21. b3 g5 22. Bxd6 Qxd6 23. g3 Nd7 24. Bg2 Qf6 25. a3 a5 26. axb4 axb4

27. Qa2 Bg6 28. d6 g4 29. Qd2 Kg7 30. f3 Qxd6 31. fxg4 Qd4+ 32. Kh1 Nf6 33.

Rf4 Ne4 34. Qxd3 Nf2+ 35. Rxf2 Bxd3 36. Rfd2 Qe3 37. Rxd3 Rc1 38. Nb2 Qf2

39. Nd2 Rxd1+ 40. Nxd1 Re1+ 0-1


And it give the same basic result.

Link to comment
Share on other sites

When you say "the same basic result", what exactly do you mean?
If you click on the h8 square, you'll get the help file.
The a8 square will always give you the debug information. If you wish to check the position, just click on the moves, not the board. (each square on the board "does something").
You can also click on the arrows below the board.

Larry is currently re-writing the bbcode to improve a couple of things.

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...
  • 1 month later...

Telemachus, thanks so much for sponsoring this! I love this.

I had a couple questions which were deleted from JLogica when the file was moved, so I will ask again here:

* Is there any way to modify the background color? It comes out as pretty white to me which is hard to look at on a dark skin.

* Are there abbreviations for "initialvariation' and 'initialgame'?

As a datapoint to others, here are the abbreviations for the other commands since they are not in the instructions here:

•h → height: (286* to 1024)

•d → display: horizontal* or vertical
•sm → showmoves: figurine*, text, puzzle, hidden
•ihm → initialhalfmove: start*, end, random, comment or a numeric value
•apm → autoplaymode: game*, loop, none

Also I also wrote a tutorial on how to use this code here.

Link to comment
Share on other sites

Question: Can you see the full Anderssen game? I can only see up to move 13, Qg5, then it gets stuck there.

Thanks for pointing that out. My mistake was to make a hard break after the 13th move. This made the program see 14 as connected which led it to concatenate an extra 14 for whatever reason. This shows how things will concatenate if you do that:


Link to comment
Share on other sites

Which program did you use to get the pgn code?

In your code, it seems that your moves 10 to 14 are not in the correct format, as they appear stuck together without any spaces in between, and that will definitely cause trouble.

I just downloaded a random PGN library and pasted the code as is. You might have seen my post before I edited in some changes. But there was a hard break (with no space) that was making the 14 seem stuck to 13. Resolved now thanks.

We're on page 2 so here's a repeat of my support questions:

  • Can we change the background color somehow?
  • Can we make the PGNs narrower somehow?
  • Are there abbreviations for 'initialvariation' and 'initialgame'?
Link to comment
Share on other sites



The board width is set by the container. To allow user access would be a bad idea.

Line 367 of the bbcode pgn.php file add styles there if you like.

Link to comment
Share on other sites

Line 367 of the bbcode pgn.php file add styles there if you like.

Thank you very much for the response, but I tried just about every permutation of code that I could think of to try and make it change color but nothing would change it (I was emptying my cache each time).

This is line 367: <textarea id='pgn4web_{$cnt}' style='display: none;'>

I'm hoping I won't need to buy a support ticket since I need to save up my money for Houdini 3. Any speculation on what to put there would be appreciated.

Link to comment
Share on other sites

Not much point getting me to look at it, I am a coder not a css/style person. You would be better of asking in the base js support and finding an answer there.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...