The Abersand in the text can often affect how javascript reads the text and it may stop the text being processed correctly as it is a character used by the javascript language, escaping it with \& or replacing it with the word 'and' can often fix that issue.
My buttons have similar code to yours and work correctly.
Have you tried replacing your php code
html:'<?php echo $stempel; ?>',
with say
html:'This is a test',
Then see if the 'This is a test' appears correctly, if it does check that you are not calling the php variable before it has been populated, (In other words your
<?php echo $stempel; ?>
is not being used before your script has put a value in it.)
Hi Steave, this is an file with 5k, becaus it is from a php generator. I'm afride that would not be easy or helpfull to read.
For me it would be helpfull that someone can confirme that it is proved / already done that php code is processable at runtime within button java code.
To avoid confusing with the php generated file, I'll try to create empty page just with chk editor and an <?php echo 'Hallo World'?> button szenario.
Re: HTML Buttons. Buttons to insert any HTML that you want.
Re: HTML Buttons. Buttons to insert any HTML that you want.
Re: HTML Buttons. Buttons to insert any HTML that you want.
Translations
Can you advice how do I add translations to the custom made buttons? Please.
Scayt and HTML Buttons
I have HTML Buttons working but when I add them I lose all menu options for SCAYT.
SCAYT works fine without HTMLButtons but as soon as I add HTML Buttons the menu options for SCAYT disappear and are replaced with {label}
Anyone had the same, and found a solution? Please.
Regards
Steve
modify button to print content from php variable
using chk editor and I'm realy happy with. Following this howto I was able to create my own button.
There is just one missing step to fullfil my needs. What I like to day is to fill the writing erea with data, which comes from php app.
Therefore I design the button as folowing:
CKEDITOR.config.htmlbuttons = [
{
name:'button1',
icon:'icon-stempel-gruen.png',
html:'<?php echo $stempel; ?>',
title:'Your name & time stamp'
},
But no text will be shown after I pressing the button.
Any Idea?
modify button to print content from php variable @gregor4711
Is the above your entire code?
If so there should be no comma after the ending curly brace, and there should be a square closing bracket on the end like:
CKEDITOR.config.htmlbuttons = [ { name:'button1', icon:'icon-stempel-gruen.png', html:'<?php echo $stempel; ?>', title:'Your name & time stamp' } ];Also you might want to get rid of the ambersand as that can sometimes affect the operation use 'and' instead, or try escaping the & .
You will also want to clear your browser cache as it may be displaying the previous version of the CKeditor from the cache.
regards
Steve
Hi Steve, many thanks for
Hi Steve, many thanks for your answer.
my code is descriped as in your example. I just copy the custom html butten example from here to my chk instalaition. Works great:)
I try all combinations with ambersand and without but no success.
btw. What you mean with "affect the operation use 'and' instead,"
BR
Hi Steve, many thanks for @gregor4711
The Abersand in the text can often affect how javascript reads the text and it may stop the text being processed correctly as it is a character used by the javascript language, escaping it with \& or replacing it with the word 'and' can often fix that issue.
My buttons have similar code to yours and work correctly.
Have you tried replacing your php code
with say
Then see if the 'This is a test' appears correctly, if it does check that you are not calling the php variable before it has been populated, (In other words your
is not being used before your script has put a value in it.)
regards
Steve
Hi Steve, following your
Hi Steve, following your recomandation...
1. Yes the text appears in the editor (plugin should be ok)
2. Regards to initialisation of php variable I was pretty sure (but he shit happend:))
Therefore I changed it to
The session variable is aviable before I call the page with CHK editor.
The "****####" is shown when I press the button but not the rest.
Is there may be a limitation in chk which not allows to load php content at this time?
Many Thanks for your support
BR
@gregor4711
I know you probably already have, but the editor is being loaded on a .PHP page?
And you have added
at the top of the PHP page before all content to allow the session variable to be used?
I don't know whether this would make any different but I would have added the PHp as:
regards
Steve
yes, you are right I also
yes, you are right I also think about this issue, which lead me to the folowing example:)
html:'****####<?php echo("Hallo world")?>',but just the non php stuff is showing. Is there an other posibility to include php code into javascript?
For me it looks like it is more an issue to inject php stuff into, rather than an issue of php variable.
Whats your thoughts about that?
Many Thanks & BR
@gregor4711
Hi,
I would need to see the whole page's HTML to be able to help further.
Can you post or attach the html of the page ?
regards
Steve
Hi Steave, this is an file
Hi Steave, this is an file with 5k, becaus it is from a php generator. I'm afride that would not be easy or helpfull to read.
For me it would be helpfull that someone can confirme that it is proved / already done that php code is processable at runtime within button java code.
To avoid confusing with the php generated file, I'll try to create empty page just with chk editor and an <?php echo 'Hallo World'?> button szenario.
BR