Hey all,

I've set up FCKeditor using the following code in my helper:

<?php
class FckHelper extends AppHelper
{
    var $helpers = array('Javascript');

    function load( $template = 'default', $height = '300', $width =
'650', $toolbar = 'Default' )
    {
        $jsDS = '/'; //because \' only suxx in javascript
        $js = $this->webroot . 'js' . $jsDS . 'fckeditor' . $jsDS;
        $skinDir = $js . 'editor' . $jsDS . 'skins' . $jsDS;
        $templateDir = $skinDir . (is_dir( $skinDir . $template ) ?
$template : 'default') . $jsDS;

        $code  = "fckLoader = function ( ID ) {";
        $code .= " var bFCKeditor = new FCKeditor( ID );";
        $code .= " bFCKeditor.BasePath = '" . $js . "';";
        $code .= " bFCKeditor.ToolbarSet = '" . $toolbar . "';";
        $code .= " bFCKeditor.SkinPath = '" . $templateDir . "';";
        $code .= " bFCKeditor.Height = " . $height . ";";
        $code .= " bFCKeditor.Width = " . $width . ";";
        $code .= " bFCKeditor.ReplaceTextarea();";
        $code .= " }";

        return $this->Javascript->link('fckeditor/fckeditor.js') .
$this->Javascript->codeBlock($code);
    }

    function editor( $fieldName )
    {
        $seperator = (strstr($fieldName, '.') ? '.' : '/');
        $id = Inflector::camelize( str_replace($seperator, '_',
$fieldName) );
        $code = "fckLoader('" . $id . "');";

        return $this->Javascript->codeBlock($code);
    }
}
?>


I'm using it with many different users and I'm looking for a way to
upload images and store them as webroot/img/userid.

Sessions didn't  worked so i have hacked into the various files to
create a FCKConfig.ImageUploadURL have an extra get variable on the
end.

It all works fine except i cannot pass the userid to the fckconfig.js.

I've tried


$code .= " bFCKeditor.Config['Testing'] = " . $test . ";";


and then added to the end of the FCKConfig.ImageUploadURL but it is
coming through as undefined.

Am i missing something or is there a better way of doing this.

I would really appreciate some guidance as I am on the point of
throwing out my computer.

Many thanks

Alex
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to