Page 1 of 1

$a='b'.$a.'c';

Posted: Wed Jul 29, 2009 12:29 pm
by kinabaloo
$a='b'.$a.'c';

says there is a syntax error.

Really?

Re: $a='b'.$a.'c';

Posted: Wed Jul 29, 2009 1:36 pm
by kinabaloo
McInfo wrote:Is that the entire script?

Could it be a "Notice: Undefined variable"?
already defined.

is this the correct way to comine the strings?

Re: $a='b'.$a.'c';

Posted: Wed Jul 29, 2009 2:12 pm
by kinabaloo
McInfo wrote:Is the original $a really a string? To test, use var_dump().

Code: Select all

var_dump($a);
//$a='b'.$a.'c';
PHP Manual: String Operators
I think it might be an array of strings.

I dont have a php editor system - i can just see 1 error in the browser, that's all.

Here's the code I am trying to modify:

Code: Select all

 
 
/**
     * Get the editor contents
     *
     * @param   string  The name of the editor control
     */
    function getContent( $editor )
    {
        $this->_loadEditor();
 
        $args['name'] = $editor;
        $args['event'] = 'onGetContent';
 
        $return = '';
        $results[] = $this->_editor->update($args);
        foreach ($results as $result) {
            if (trim($result)) {
                $return .= $result;
            }
        }
        return $return;
    }
 
 
    /**
     * No WYSIWYG Editor - get the editor content
     *
     * @param string    The name of the editor
     */
function onGetContent( $editor ) { 
          $aaa = "document.getElementById( '$editor' ).value;\n"; 
 
// I NEED TO ADD SOME CODE HERE TO CHANGE \n to <BR />
 
    return $aaa; 
}
 
 

Re: $a='b'.$a.'c';

Posted: Wed Jul 29, 2009 2:33 pm
by kinabaloo
McInfo wrote:Is this part of an application package that can be downloaded somewhere?
Yes, but a big one - Joomla.

None of the available editors allow entry of simple plain text. Well one does but it is just textarea and the line feeds are not changed to html breaks. So I am trying to modify the source (it is open source GPL).

But the form contains other fields too, such as title and category to store the text. I think all this is bundled into one array. Ideally I'd know which element of the array to do the replacements on.

Re: $a='b'.$a.'c';

Posted: Wed Jul 29, 2009 2:41 pm
by kinabaloo
McInfo wrote:What version of Joomla is it?
The latest : 1.5.13

My site is at:

http://www.tji-java-ide.com/beijing

Everyone can publish, so to keep a consistent look, I dont want an editor with fonts etc.

Just very simple.

ps: I will be back in 10-15 mins ...

Re: $a='b'.$a.'c';

Posted: Wed Jul 29, 2009 3:42 pm
by Eran
says there is a syntax error.
What is the full error message?
I think it might be an array of strings.
In that case the operation you described would certainly be invalid. You can't cast an array into a string - either use something like implode() or manually concatenate the array parts together.

Re: $a='b'.$a.'c';

Posted: Wed Jul 29, 2009 3:51 pm
by kinabaloo
McInfo wrote:
kinabaloo wrote:

Code: Select all

function onGetContent( $editor ) {
    $aaa = "document.getElementById( '$editor' ).value;\n";
    // I NEED TO ADD SOME CODE HERE TO CHANGE \n to <BR />
    return $aaa;
}
kinabaloo wrote:I dont want an editor with fonts etc.
How are these two objectives related?
Not sure I see your point. It's important to have separate paragraphs because articles may be say 1000 words+.

But the font, color etc will be a constant, decided by the site design rather than by authors.

Re: $a='b'.$a.'c';

Posted: Wed Jul 29, 2009 4:02 pm
by kinabaloo
pytrin wrote:
says there is a syntax error.
What is the full error message?
I think it might be an array of strings.
In that case the operation you described would certainly be invalid. You can't cast an array into a string - either use something like implode() or manually concatenate the array parts together.
Thanks for your input. I'll try to work out a way to loop through the array or discover which element is the main editor text.

Re: $a='b'.$a.'c';

Posted: Wed Jul 29, 2009 4:04 pm
by kinabaloo
McInfo wrote:
kinabaloo wrote:

Code: Select all

function onGetContent( $editor ) {
    $aaa = "document.getElementById( '$editor' ).value;\n";
    // I NEED TO ADD SOME CODE HERE TO CHANGE \n to <BR />
    return $aaa;
}
kinabaloo wrote:I dont want an editor with fonts etc.
How are these two objectives related?
The user will see line breaks when they edit and press enter. This should be preserved when the article is displayed. So either with <pre> or by changing \n to <br />

Re: $a='b'.$a.'c';

Posted: Wed Jul 29, 2009 4:22 pm
by kinabaloo
McInfo wrote:Is the real problem that you are trying to change the editor from this
Joomla-Advanced.png
to this?
Joomla-Simple.png
That might be ideal - if it preserves line breaks by converting them to <br />

At the moment, I have a problem whereby I can't change the editor :(

Assuming I might fix that problem at some time, which editor is that second one?

Thanks so much for your help, btw.

Re: $a='b'.$a.'c';

Posted: Wed Jul 29, 2009 4:38 pm
by kinabaloo
McInfo wrote:First, put the function back the way it was:

Code: Select all

    function onGetContent( $editor ) {
        return "document.getElementById( '$editor' ).value;\n";
    }
Next, go into Joomla's administration control panel.
  1. On the menu bar, locate Extensions > Plugin Manager.
  2. In the list of plugins, locate "Editor - TinyMCE" and ensure that it is enabled (green checkmark).
  3. Click on the hyperlink labeled "Editor - TinyMCE".
  4. On the plugin edit page, under Plugin Parameters, change Functionality to "Simple".
  5. Click Save at the top of the page.
I know that is right, but something has gone wrong with my Joomla. I have changed all the enables etc but the editor will not budge from Noeditor :(

It is so frustrating.

Re: $a='b'.$a.'c';

Posted: Wed Jul 29, 2009 4:54 pm
by kinabaloo
McInfo wrote:How much of Joomla's source code have you modified?

Have you tried disabling all of the Editor plugins and re-enabling just the TinyMCE plugin?
Tried that.

I just modied form.php to simplify it. article.php to set new article to 'pulished' status.
And a minor change in icon.php to fix something for an extension.
And vote.php to be able to display just the actual vote and not the add vote part when displayed not in full.
And some views to enable link of author to profile.
A couple language ini files.

What files do you know would affect which editor runs?

Re: $a='b'.$a.'c';

Posted: Wed Jul 29, 2009 6:57 pm
by kinabaloo
McInfo wrote:
kinabaloo wrote:What files do you know would affect which editor runs?
That setting is stored in the database. You are supposed to use the Joomla admin interface to make changes.
Installed JCE editor and finally the editor is no longer stuck on noeditor :)

So I don't need to learn php quite so quickly now ;)

Thanks all you guys for your help !