Insert a variable instead of plain chess notation into the pgn viewer. #303
-
Hello @mliebelt, I am Andrea from Italy. I am writing a website for the chess club of my town, and embedding the PgnViewerJS is an elegant way to show some games. I have to say, first of all, that my programming experience is almost... null After linking the stylesheet and the script in the header and inserting the
Is this solution correct? Actually, I tried it in the browser and partially it works: it creates me a new board into that div with the id "chessboard", but does not show the notation. How can I resolve this? Thank you for your work Greetings from Italy! |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 18 replies
-
Let me rephrase what you try to do, just to understand:
Why not just embed it in that way. Code could look like: var notation = document.getElementById("chess").innerHTML;
PGNV.pgnView('chessboard', { pgn: notation, width: 400px })); That is similar to your code, but without the extra redirection (creating text for a script, embedding it). If you want to set the notation for the viewer at runtime, that is a complete different story. There should be an API (I have to look that up, and create then an example for it) to set the notation in an empty player at runtime. Or is the above code already a solution for you? |
Beta Was this translation helpful? Give feedback.
-
Well, re-reading now I understand that maybe mine is an Off Topic question... You have been already exhaustive and I thank you again. Actually the solution works and is more linear than the previous made by me. I will write you when I ll find the solution! :) |
Beta Was this translation helpful? Give feedback.
-
HELLO again @mliebelt I found the solution for that thing that I was asking you! It was a issue of sintax if the solution did not work. Now i have a page with a list of games and by clicking on one of them....... tadàààà the chessboard with the relative notation appears! I answer only now because is all the afternoon that i search for the solution. By the way I have to ask you last thing, have patience. what about (C stands for 'Cavallo' that is the Knight) Thank you very much, I will show you the url of the website when it will be finished :D Bye! Andrea from Italy |
Beta Was this translation helpful? Give feedback.
-
Thank you, now I understand. Yes it is perfect. Thank you again, I will show you the website when it is online so you can see, if you like! I salute you! :) |
Beta Was this translation helpful? Give feedback.
-
one further thing @mliebelt sorry, is there a way to highlight the current move like happens in the examples on the documentation page? |
Beta Was this translation helpful? Give feedback.
-
I forked your project for error, sorry! |
Beta Was this translation helpful? Give feedback.
-
Sorry @mliebelt if you have seen that I forked your project but it was by accident! :) |
Beta Was this translation helpful? Give feedback.
-
@mliebelt sir i promise this is the last message from me :D but help me please to understand about the highlighting of the current move. I call in the head jquery Where I make the mistake? Thanks for the patience! |
Beta Was this translation helpful? Give feedback.
-
Hi @mliebelt, sorry if I disturbed you many times, I would like to tell you that all works fine I dont know where I made the mistake in the code. Thank you for all. Andrea |
Beta Was this translation helpful? Give feedback.
@mliebelt
Well, re-reading now I understand that maybe mine is an Off Topic question... You have been already exhaustive and I thank you again. Actually the solution works and is more linear than the previous made by me. I will write you when I ll find the solution! :)