Categories > TinyButStrong general >

How to send fckeditor output (input form) to template

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: TomH
Date: 2009-11-19
Time: 22:50

How to send fckeditor output (input form) to template

Maybe OT because I need a PHP lesson ;)

I am trying to use an fckeditor 'edit form' in a TBS template inside a table cell but instead it appears the the fcked edit form gets sent to the browser screen immediately when the fckeditor function is called...

My php code
// ---- I do the PHP - database & TBS class stuff here ----
// ---- start FCKeditor stuff here ----
$oFCKeditor = new FCKeditor('FCKeditor1') ;
$oFCKeditor->BasePath = '/FCKed/';
$oFCKeditor->Value = $intro; // will preload the textarea if set

// ---- tried passin as a simple var ----
$fckedit_intro_pane = $oFCKeditor->Create() ;
// ---- also tried to pass it this way  ----
// $fckedit_intro_pane = print_r($oFCKeditor->Create(),true) ;

$TBS->Show() ;

The template is like...
<table align=center width=800 bgcolor="#FFFFD2" cellspacing="0" cellpadding="12" border="1">
<tr>
<td>
    <form action="" method="post">
<tr>
<td>Article Headline:<br>       
<input type='text' name='descript' value="[onshow.descript]" size='32' maxlength='80'>
<hr align=left color=gray width=450 size=2>
Frontpage Intro (this section shows on the front page)    
<br>
[var.fckedit_intro_pane]
<br>
<hr align=left  color=gray width=450 size=2>
More Content (this section shows when 'more...' link is clicked)    

<br>
[onshow.fckedit_more_pane]
<br>

<hr align=left color=gray width=450 size=2>
<div align=""><input name="action" type="submit" value="Submit">
</div>
</form>
</td>
</tr>
</table>

Any ideas/hints/tips (or tutorial on PHP) appreciated,
TomH
By: Skrol29
Date: 2009-11-19
Time: 23:37

Re: How to send fckeditor output (input form) to template

Hi TomH,

The method $oFCKeditor->Create() does an echo() immediately when you call it. Use $oFCKeditor->CreateHtml() in order to retrieve the HTML source to insert instead of echo it.
$fckedit_intro_pane = $oFCKeditor->CreateHtml();

Don't forget to use htmlconv=no to insert HTML in the template:
[onshow.fckedit_more_pane;htmlconv=no]
By: TomH
Date: 2009-11-19
Time: 23:53

Re: How to send fckeditor output (input form) to template

Your fix worked immediately,
thanks for your experience with FCKeditor.

Most sincerely,
TomH