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.
Options

echo variable

need help with a php command
I want to output this code
echo "path = {$Configuration['WEB_ROOT'] }";
the value of $Configuration is not outputtted
Any idea

Comments

  • Options
    I dunno what your {}'s are there for but otherwise i dont see why that shouldnt work. Try echo "path = ".$Configuration['WEB_ROOT'];
  • Options
    edited October 2006
    Tell us what is your error message, or what is displayed, because
    echo 'path = '.$Configuration['WEB_ROOT']; or echo "Path = $Configuration['WEB_ROOT']"; should work.
  • Options
    edited October 2006
    ok this is what I have
    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
  • Options
    No idea why. Are the rest of the paths being set correctly? Can you just echo a $Configuration['WEB_ROOT'] and make sure it's set to the right thing?
  • Options
    Is it working with oFCKeditor.Config["CustomConfigurationsPath"] = "/vanilla/extensions/FCKeditor/config.js" ;
    You can try (with friendly url off):oFCKeditor.Config["CustomConfigurationsPath"] = "../../../extensions/FCKeditor/config.js" ;
  • Options
    edited October 2006
    yeah mini, thats interesting that it complains of only the config.js, yet doesn't say it can't find the content.css or the fckstyles.xml file.the $configuration doesn't give anything. Its blank. there is nothing in the code which would say that it shouldn't work. perhaps its just my server its messing up with paths.
  • Options
    edited October 2006
    ok it works using the ../../ thingy
    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'); }
  • Options
    I think technically it is 'bad practice' since if the extension/js folders move relative to each other it'l break your extension. That said I dont see that happening in the near future so it's not really a problem. Atleast you tried doing it the 'proper' way!
  • Options
    edited October 2006
    That's bad for friendly url. ../../../extensions/FCKeditor/config.js from this page is http://lussumo.com/community/discussion/4117/echo-variable/extensions/FCKeditor/config.js Here is a fix http://lussumo.com/community/discussion/2803/search-engine-friendly-urls-breaks-extension-manager/#Item_10 (Need new edit to it, some extensions still having issue with it). The real fix is to avoid relative url - when you can. EDIT: Maybe it is ok since you give to the script the base url (oFCKeditor.BasePath = "' . $Configuration['WEB_ROOT'] . 'js/FCKeditor/").
  • Options
    Ahh yeah well noticed dinoboff. The point here is that he tried giving it the base url and failed so now he's using relative paths. Maybe he'll have to think again.
  • Options
    edited October 2006
    I know Minisweeper, I told him to try relative path since absolute path wasn't working with oFCKeditor.Config["CustomConfigurationsPath"].

    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.
  • Options
    edited October 2006
    Ok, here is the fix for your script:<?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
  • Options
    edited October 2006
    thats the whole class, thats the whole code beside the kses thingy. the reason I'm changing it cause people want fckeditor to be used in the Page extension as well. plus i wanted to get rid of windows.onload function. i did it this way cause Sirnot preview extension does it. He obviously knows better than me. So i'm trying to do it the way he did it. He used just a class and then echoed the script and added it to the comment form using AddToDelegate. Should i not do that? with a class i can prolly make it so it works in all textareas. like in the page extension there is also a textarea. btw whats that ... after $this->Context = &$Context; what does those dots mean
  • Options
    edited October 2006
    Classes are great, I use one for my tinyMCE editor extension, however, if your class is just one methode, why not just use a function: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
  • Options
    thanks dino ur previous class patch works just fine. uploaded version v1.55 of fckeditor

    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
  • Options
    $Context->AddToDelegate(' NameOfTheClassToChange', 'It'sDelegation', 'FunctionToAdd'); Why do you need a delegation?
  • Options
    edited October 2006
    because i'm adding it right after the textarea, rather than the header and have it on window.onload. ok the none class version is giving the same path errors. So i'm going to stick with the class one thanks dinoboff
  • Options
    edited October 2006
    What have you tried?
    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'); }
This discussion has been closed.