View previous topic :: View next topic |
Author |
Message |
JonZenor Smarty Rookie
Joined: 03 Jun 2008 Posts: 5
|
Posted: Sat Sep 13, 2008 12:51 am Post subject: |
|
|
Hey guys, awesome job on doing this little script.
I'm having problems with one thing though. I am trying to get an API function to work from the FCKEditor, and it just doesn't seem to want to work with Smarty.
Code: |
function InsertHTML( HTML ) {
var oEditor = FCKeditor.API.GetInstance('" . $base_arguments['InstanceName'] . "' );
if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG )
{
oEditor.InsertHtml( HTML );
}
else
alert( 'You must be on WYSIWYG mode!' );
}
|
This should in theory allow me to have a link with: onclick="InsertHTML('<b>Testing</b>')"
Then when the link is clicked it should insert that html code into the editor box.
But it doesn't seem to work.. any ideas? |
|
Back to top |
|
phrearch Smarty n00b
Joined: 06 Oct 2008 Posts: 1
|
Posted: Mon Oct 06, 2008 8:52 am Post subject: |
|
|
great plugin!
It's not producing valid w3c html this way though, because the strings are not escaped well. Use this function for value:
Code: | function jschars($str)
{
$str = mb_ereg_replace("\\\\", "\\\\", $str);
$str = mb_ereg_replace("\"", "\\\"", $str);
$str = mb_ereg_replace("'", "\\'", $str);
$str = mb_ereg_replace("\r\n", "\\n", $str);
$str = mb_ereg_replace("\r", "\\n", $str);
$str = mb_ereg_replace("\n", "\\n", $str);
$str = mb_ereg_replace("\t", "\\t", $str);
$str = mb_ereg_replace("<", "\\x3C", $str); // for inclusion in HTML
$str = mb_ereg_replace(">", "\\x3E", $str);
return $str;
}
|
Make sure you have something like this, when the value is parsed...
Code: | foreach($base_arguments as $key => $value)
{
if(!is_bool($value))
{
$value = '"' . jschars($value) . '"';
}
$out .= "oFCKeditor.$key = $value; ";
} |
|
|
Back to top |
|
P@ul Smarty n00b
Joined: 14 Oct 2008 Posts: 3
|
Posted: Tue Oct 14, 2008 12:00 pm Post subject: Smarty and FCKEditor |
|
|
Hello all,
Ik have started with smarty yesterday. I am traying to get fckeditor working but i can't get it to work. Has someone o idee the code is:
Template:
<form action="{$currpage}" enctype="multipart/form-data">{fckeditor BasePath="pathpath/Smarty/fckeditor/" InstanceName="editor" Width="100%" Height="90%"}</form> |
|
Back to top |
|
Celeb Administrator
Joined: 17 Apr 2007 Posts: 1025 Location: Vienna
|
Posted: Tue Oct 14, 2008 12:02 pm Post subject: |
|
|
How exactly does it not work? _________________ Darn computers always do what I tell them to instead of what I want them to do. |
|
Back to top |
|
P@ul Smarty n00b
Joined: 14 Oct 2008 Posts: 3
|
Posted: Tue Oct 14, 2008 12:04 pm Post subject: FCK Editor |
|
|
Wel i have tested everything i can find in the forum but i can't get the editor on the screen. i get a blank page. |
|
Back to top |
|
Celeb Administrator
Joined: 17 Apr 2007 Posts: 1025 Location: Vienna
|
Posted: Tue Oct 14, 2008 12:22 pm Post subject: |
|
|
If you're getting a blank page try checking your error logs, or turn display_errors on and set error_reporting to E_ALL. _________________ Darn computers always do what I tell them to instead of what I want them to do. |
|
Back to top |
|
P@ul Smarty n00b
Joined: 14 Oct 2008 Posts: 3
|
Posted: Tue Oct 14, 2008 12:27 pm Post subject: |
|
|
Well, i am new with smarty and i am tray to learn but the erros on How ???
sorry i am new.
I have now put in de template <div id="footer">Powered by Smarty {$smarty.version}</div> that is the onley thing he show
Template±
<div id="footer">Powered by Smarty {$smarty.version}</div>
<form action="{$currpage}" enctype="multipart/form-data">{fckeditor BasePath="home/default/Smarty/fckeditor/" InstanceName="editor" Width="100%" Height="90%"}</form>
PHP
<?php
##### Default settings #####
require('includes/includes.php');
require('includes/settings.php');
##### Include template engine #####
$smarty = new Smarty_app();
/*-------- ##### Script Start ##### --------*/
##### Default parameters #####
$naam = "Test";
$Plaats = "Plaats";
$Tel ="0000000000";
/*-------- ##### Script End ##### --------*/
##### Filds to display #####
$smarty->assign('title', $AppName);
$smarty->assign('naam',$naam);
$smarty->assign('plaats',$Plaats);
$smarty->assign('tel',$Tel);
$smarty->assign('melding',$melding);
##### Display template #####
$smarty->display('header.tpl');
$smarty->display('index.tpl');
$smarty->display('footer.tpl');
?> |
|
Back to top |
|
gazoot Smarty Regular
Joined: 20 Feb 2005 Posts: 35
|
Posted: Thu Nov 06, 2008 10:45 pm Post subject: |
|
|
phrearch wrote: | great plugin!
It's not producing valid w3c html this way though, because the strings are not escaped well. Use this function for value:
|
Hello and thank you phrearch, the plugin is updated with your modification. Works great! I'm glad you took time to improve the quoting, I was a bit too lazy doing it originally.
/Gazoot |
|
Back to top |
|
IceFrog Smarty Rookie
Joined: 16 Dec 2008 Posts: 13
|
Posted: Tue Dec 16, 2008 11:28 pm Post subject: Trouble |
|
|
Hello all.
Plz help me this plugin.. on smarty.
Do no work upload, and some function, any body may give some examples smarty and fckeditor, thanks... |
|
Back to top |
|
gazoot Smarty Regular
Joined: 20 Feb 2005 Posts: 35
|
Posted: Sat Dec 20, 2008 6:10 pm Post subject: |
|
|
Hello IceFrog, what do you need help with? Can you show the code that isn't working? |
|
Back to top |
|
IceFrog Smarty Rookie
Joined: 16 Dec 2008 Posts: 13
|
Posted: Fri Dec 26, 2008 11:09 pm Post subject: |
|
|
gazoot wrote: | Hello IceFrog, what do you need help with? Can you show the code that isn't working? |
Hey gazoot, I already knew how to work with Editor |
|
Back to top |
|
IceFrog Smarty Rookie
Joined: 16 Dec 2008 Posts: 13
|
Posted: Fri Dec 26, 2008 11:26 pm Post subject: |
|
|
gazoot wrote: | Hello IceFrog, what do you need help with? Can you show the code that isn't working? |
New question:
This code from the editor (source)
Code: |
<table width="200" border="1" cellpadding="1" cellspacing="1">
<tbody>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<p> <img width="348" height="500" alt="" src="/userfiles/24259-284509-19-obl-l.jpg" /></p>
|
When me POST this - I get this:
Code: |
<table width="200" border="1" cellpadding="1" cellspacing="1"><br/> <tbody><br/> <tr><br/> <td> </td><br/> <td> </td><br/> </tr><br/> <tr><br/> <td> </td><br/> <td> </td><br/> </tr><br/> <tr><br/> <td> </td><br/> <td> </td><br/> </tr><br/> </tbody><br/></table><br/><p> <img width="348" height="500" alt="" src="/userfiles/24259-284509-19-obl-l.jpg" /></p>
|
What should I correct in the editor?
And again:
I am very irritated:
|
|
Back to top |
|
IceFrog Smarty Rookie
Joined: 16 Dec 2008 Posts: 13
|
Posted: Fri Dec 26, 2008 11:34 pm Post subject: |
|
|
hm I fix first problem
Code: | $redtextcont = str_replace("\n","",$redtextcont); |
|
|
Back to top |
|
muhammad Smarty Rookie
Joined: 07 May 2009 Posts: 5
|
Posted: Thu May 07, 2009 11:08 am Post subject: Plugin for FCKeditor |
|
|
Hi gzoot, plz tell me where to include the code given. |
|
Back to top |
|
muhammad Smarty Rookie
Joined: 07 May 2009 Posts: 5
|
Posted: Thu May 07, 2009 11:14 am Post subject: Fck Plugin By Gzoot |
|
|
plz tell me where to inlude the code given |
|
Back to top |
|
|