Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
echo variable
need help with a php command
I want to output this code
the value of $Configuration is not outputtted
Any idea
I want to output this code
echo "path = {$Configuration['WEB_ROOT'] }";
the value of $Configuration is not outputtted
Any idea
0
This discussion has been closed.
Comments
echo 'path = '.$Configuration['WEB_ROOT']; or echo "Path = $Configuration['WEB_ROOT']"; should work.
echo ' <script type="text/javascript"> var oFCKeditor = new FCKeditor("Body") ; oFCKeditor.BasePath = "' . $Configuration['WEB_ROOT'] . 'js/FCKeditor/" ; oFCKeditor.Config["CustomConfigurationsPath"] = "' . $Configuration['WEB_ROOT'] . 'extensions/FCKeditor/config.js" ; oFCKeditor.Config["StylesXmlPath"] = "' . $Configuration['WEB_ROOT'] . 'extensions/FCKeditor/fckstyles.xml" ; oFCKeditor.Config["EditorAreaCSS"] = "' . $Configuration['WEB_ROOT'] . 'extensions/FCKeditor/content.css"; oFCKeditor.ToolbarSet = "Vanilla" ; oFCKeditor.ReplaceTextarea() ; </script> ';
It cannot file the config.js file because its looking in
vanilla/js/FCKeditor/editor/extensions/FCKeditor/config.js
which is obviously wrong path it should be
vanilla/extensions/FCKeditor/config.js
oFCKeditor.Config["CustomConfigurationsPath"] = "/vanilla/extensions/FCKeditor/config.js" ;
You can try (with friendly url off):
oFCKeditor.Config["CustomConfigurationsPath"] = "../../../extensions/FCKeditor/config.js" ;
Now if i do that will it work for everyone. plus is it a good practice to do that instead of using the $Configuration variable.
i want to make it just like u guys make it. So i'm using the AddDelegate thingy to echo the fckeditor javascript
I have it working liek this. let me know if its badly codded
if ( in_array($Context->SelfUrl, array("post.php", "comments.php")) ) { class FCKeditorBar { function FCKeditorBar_Create() { print ' <script type="text/javascript"> if (document.getElementById("CommentBox")) { document.getElementById("CommentBoxController").style.display = "none"; var oFCKeditor = new FCKeditor("Body") ; oFCKeditor.BasePath = "' . $Configuration['WEB_ROOT'] . 'js/FCKeditor/" ; oFCKeditor.Config["CustomConfigurationsPath"] = "../../../extensions/FCKeditor/config.js" ; oFCKeditor.Config["StylesXmlPath"] = "../../../extensions/FCKeditor/fckstyles.xml" ; oFCKeditor.Config["EditorAreaCSS"] = "../../../extensions/FCKeditor/content.css"; oFCKeditor.ToolbarSet = "Vanilla" ; oFCKeditor.ReplaceTextarea() ; } </script> '; } } } function AddFCKeditortoCommentForm(&$DiscussionForm) { $FCKeditorBar = new FCKeditorBar($DiscussionForm->Context); $FCKeditorBar-> FCKeditorBar_Create(); } $Configuration["FCKEDITOR_LOGINREQUIRED"] = true; //if u are using Add Comments Extension set this to false if( $Configuration["FCKEDITOR_LOGINREQUIRED"]===false or $Context->Session->UserID > 0 ){ $Head->AddScript('js/FCKeditor/fckeditor.js'); $Context->AddToDelegate('DiscussionForm', 'DiscussionForm_PreButtonsRender', 'AddFCKeditortoCommentForm'); $Context->AddToDelegate('DiscussionForm', 'CommentForm_PreButtonsRender','AddFCKeditortoCommentForm'); }
I just try to explain why it is a bad pratice for friendly url. Before realise that maybe it might be ok with FCKeditor since maybe it use oFCKeditor.BasePath and not the friendly url as base url.
<?php if ( in_array($Context->SelfUrl, array("post.php", "comments.php")) ) { class FCKeditorBar { var $Context; //Constructor function FCKeditorBar(&$Context) { $this->Context = &$Context; ... } function FCKeditorBar_Create() { print ' <script type="text/javascript"> if (document.getElementById("CommentBox")) { document.getElementById("CommentBoxController").style.display = "none"; var oFCKeditor = new FCKeditor("Body") ; oFCKeditor.BasePath = "' . $this->Context->Configuration['WEB_ROOT'] . 'js/FCKeditor/" ; oFCKeditor.Config["CustomConfigurationsPath"] = "' . $this->Context->Configuration['WEB_ROOT'] . 'extensions/FCKeditor/config.js" ; oFCKeditor.Config["StylesXmlPath"] = "' . $this->Context->Configuration['WEB_ROOT'] . 'extensions/FCKeditor/fckstyles.xml" ; oFCKeditor.Config["EditorAreaCSS"] = "' . $this->Context->Configuration['WEB_ROOT'] . '/extensions/FCKeditor/content.css"; oFCKeditor.ToolbarSet = "Vanilla" ; oFCKeditor.ReplaceTextarea() ; } </script> '; } } } function AddFCKeditortoCommentForm(&$DiscussionForm) { $FCKeditorBar = new FCKeditorBar($DiscussionForm->Context); $FCKeditorBar-> FCKeditorBar_Create(); } $Configuration["FCKEDITOR_LOGINREQUIRED"] = true; //if u are using Add Comments Extension set this to false if( $Configuration["FCKEDITOR_LOGINREQUIRED"]===false or $Context->Session->UserID > 0 ){ $Head->AddScript('js/FCKeditor/fckeditor.js'); $Context->AddToDelegate('DiscussionForm', 'DiscussionForm_PreButtonsRender', 'AddFCKeditortoCommentForm'); $Context->AddToDelegate('DiscussionForm', 'CommentForm_PreButtonsRender','AddFCKeditortoCommentForm'); } ?>
ps: Do you need to use a class. Or did you just post a part of the class
FCKeditorBar($Context) { print ' <script type="text/javascript"> if (document.getElementById("CommentBox")) { document.getElementById("CommentBoxController").style.display = "none"; var oFCKeditor = new FCKeditor("Body") ; oFCKeditor.BasePath = "' . $Context->Configuration['WEB_ROOT'] . 'js/FCKeditor/" ; oFCKeditor.Config["CustomConfigurationsPath"] = "' . $Context->Configuration['WEB_ROOT'] . 'extensions/FCKeditor/config.js" ; oFCKeditor.Config["StylesXmlPath"] = "' . $Context->Configuration['WEB_ROOT'] . 'extensions/FCKeditor/fckstyles.xml" ; oFCKeditor.Config["EditorAreaCSS"] = "' . $Context->Configuration['WEB_ROOT'] . '/extensions/FCKeditor/content.css"; oFCKeditor.ToolbarSet = "Vanilla" ; oFCKeditor.ReplaceTextarea() ; } </script> '; }
About the constructor:
"Var $Context" add a proprety to the class
$this->Context = &$Context; associate the property $this->Context to $Context.
Passing by Reference
But like u said if i only have one function then its better to use it by itself.
So now i'm going to try ur last patch
I need to change this line
$Context->AddToDelegate(' ????? ', 'DiscussionForm_PreButtonsRender', 'FCKeditorBar');
As far as i can tell. the second parameter is "where"
the third parameter is "what"
whats the first parameter. what should go in there
if ( in_array($Context->SelfUrl, array("post.php", "comments.php")) ) { function FCKeditorBar_Create($Context) { print ' <script type="text/javascript"> if (document.getElementById("CommentBox")) { document.getElementById("CommentBoxController").style.display = "none"; var oFCKeditor = new FCKeditor("Body") ; oFCKeditor.BasePath = "' . $Context->Configuration['WEB_ROOT'] . 'js/FCKeditor/" ; oFCKeditor.Config["CustomConfigurationsPath"] = "' . $Context->Configuration['WEB_ROOT'] . 'extensions/FCKeditor/config.js" ; oFCKeditor.Config["StylesXmlPath"] = "' . $Context->Configuration['WEB_ROOT'] . 'extensions/FCKeditor/fckstyles.xml" ; oFCKeditor.Config["EditorAreaCSS"] = "' . $Context->Configuration['WEB_ROOT'] . '/extensions/FCKeditor/content.css"; oFCKeditor.ToolbarSet = "Vanilla" ; oFCKeditor.ReplaceTextarea() ; } </script> '; } } function AddFCKeditortoCommentForm(&$DiscussionForm) { FCKeditorBar_Create($DiscussionForm->Context); } $Configuration["FCKEDITOR_LOGINREQUIRED"] = true; //if u are using Add Comments Extension set this to false if( $Configuration["FCKEDITOR_LOGINREQUIRED"]===false or $Context->Session->UserID > 0 ){ $Head->AddScript('js/FCKeditor/fckeditor.js'); $Context->AddToDelegate('DiscussionForm', 'DiscussionForm_PreButtonsRender', 'AddFCKeditortoCommentForm'); $Context->AddToDelegate('DiscussionForm', 'CommentForm_PreButtonsRender','AddFCKeditortoCommentForm'); }