Jump to content

[SOLVED] multiple FCKeditor - value's all identicle


Recommended Posts

I've created a small cms to edit articles on my site. I have an option to select a checkbox next to each article and then press the edit button so I can edit multiple articles at once. Each articles textarea field is replaced by FCKeditor.

 

So in PHP I have a while loop which returns each row of data (each article), and places each into a fieldset of which the article content is FCKeditor.

 

When I click on edit, however, this is returning the same value in the iframe of FCKeditor for every article, even though looking at the source reveals the display:none input field has the correct values (which are different).

 

$blog_content = $row['blog_content'];
     
$oFCKeditor = new FCKeditor('blog_content[]') ;
$oFCKeditor->BasePath = '../../add_ons/fckeditor/' ;
$oFCKeditor->ToolbarSet = 'Basic';
$oFCKeditor->Value = $blog_content ;
$oFCKeditor->Create() ;

 

The html that is being poduced:

 

Article one - value of FCKeditor field = 'Content for the first article here' - Actual value = 'Content for the first article here':

 

<input type="hidden" id="blog_content[]" name="blog_content[]" value="Content for the first article here" style="display:none" /><input type="hidden" id="blog_content[]___Config" value="" style="display:none" /><iframe id="blog_content[]___Frame" src="../../add_ons/fckeditor/editor/fckeditor.html?InstanceName=blog_content[]&Toolbar=Basic" width="100%" height="200" frameborder="0" scrolling="no"></iframe>

 

Article two - value of FCKeditor field = 'Content for the first article here' - Actual value = 'Different content here for the second article which isn't appearing in FCKeditor field':

 

<input type="hidden" id="blog_content[]" name="blog_content[]" value="Different content here for the second article which isn't appearing in FCKeditor field" style="display:none" /><input type="hidden" id="blog_content[]___Config" value="" style="display:none" /><iframe id="blog_content[]___Frame" src="../../add_ons/fckeditor/editor/fckeditor.html?InstanceName=blog_content[]&Toolbar=Basic" width="100%" height="200" frameborder="0" scrolling="no"></iframe>

 

It all in context:

 

for ($i = 0; $i<count($_POST["blog_id"]); $i++) {
     $edit_blog_id = $_POST["blog_id"][$i];
     $query = "SELECT * FROM blog WHERE blog_id = $edit_blog_id";
     $result = @mysql_query ($query);
     
     if ($result) {

while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {

     echo '<fieldset class="project_cms">
     <h3>' . $project_title_split[0] . '</h3>
     <p><label for="blog_title">Title</label> <input type="text" name="blog_title[]" value="' . $row['blog_title'] . '" /></p>
     <p><label for="blog_content">Content</label></p>
     
     <div class="editor">';

$blog_content = $row['blog_content'];
$trans = array('\n' => '', '\r' => '', '<p>&nbsp;</p>' => '');
$blog_content = strtr($blog_content, $trans);
$trans = array('<' => '<', '>' => '>', '"' => '"');
$blog_content = strtr(stripslashes($blog_content), $trans);
        
$oFCKeditor = new FCKeditor('blog_content[]') ;
$oFCKeditor->BasePath = '../../add_ons/fckeditor/' ;
$oFCKeditor->ToolbarSet = 'Basic';
$oFCKeditor->Value = $blog_content ;
$oFCKeditor->Create() ;
        
     echo '<!--editor--></div>

     <p><label for="blog_image">Image</label> <input type="text" name="blog_image[]" value="' . $row['blog_image'] . '" /><input type="hidden" name="blog_id[]" value="' . $row['blog_id'] . '" /></p>
     </fieldset>';
     }
}

 

Has anyone got any ideas on why the smae value is being displayed in all iframes, and what I can do to fix this?

 

Thanks thanks.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.