Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Plugin for FCKeditor
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    Smarty Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
JonZenor
Smarty Rookie


Joined: 03 Jun 2008
Posts: 5

PostPosted: Sat Sep 13, 2008 12:51 am    Post subject: Reply with quote

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
View user's profile Send private message
phrearch
Smarty n00b


Joined: 06 Oct 2008
Posts: 1

PostPosted: Mon Oct 06, 2008 8:52 am    Post subject: Reply with quote

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
View user's profile Send private message
P@ul
Smarty n00b


Joined: 14 Oct 2008
Posts: 3

PostPosted: Tue Oct 14, 2008 12:00 pm    Post subject: Smarty and FCKEditor Reply with quote

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
View user's profile Send private message
Celeb
Administrator


Joined: 17 Apr 2007
Posts: 1025
Location: Vienna

PostPosted: Tue Oct 14, 2008 12:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
P@ul
Smarty n00b


Joined: 14 Oct 2008
Posts: 3

PostPosted: Tue Oct 14, 2008 12:04 pm    Post subject: FCK Editor Reply with quote

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
View user's profile Send private message
Celeb
Administrator


Joined: 17 Apr 2007
Posts: 1025
Location: Vienna

PostPosted: Tue Oct 14, 2008 12:22 pm    Post subject: Reply with quote

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
View user's profile Send private message
P@ul
Smarty n00b


Joined: 14 Oct 2008
Posts: 3

PostPosted: Tue Oct 14, 2008 12:27 pm    Post subject: Reply with quote

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
View user's profile Send private message
gazoot
Smarty Regular


Joined: 20 Feb 2005
Posts: 35

PostPosted: Thu Nov 06, 2008 10:45 pm    Post subject: Reply with quote

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. Smile

/Gazoot
Back to top
View user's profile Send private message
IceFrog
Smarty Rookie


Joined: 16 Dec 2008
Posts: 13

PostPosted: Tue Dec 16, 2008 11:28 pm    Post subject: Trouble Reply with quote

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
View user's profile Send private message
gazoot
Smarty Regular


Joined: 20 Feb 2005
Posts: 35

PostPosted: Sat Dec 20, 2008 6:10 pm    Post subject: Reply with quote

Hello IceFrog, what do you need help with? Can you show the code that isn't working?
Back to top
View user's profile Send private message
IceFrog
Smarty Rookie


Joined: 16 Dec 2008
Posts: 13

PostPosted: Fri Dec 26, 2008 11:09 pm    Post subject: Reply with quote

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
View user's profile Send private message
IceFrog
Smarty Rookie


Joined: 16 Dec 2008
Posts: 13

PostPosted: Fri Dec 26, 2008 11:26 pm    Post subject: Reply with quote

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>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
    </tbody>
</table>
<p>&nbsp;<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>&nbsp;</td><br/>            <td>&nbsp;</td><br/>        </tr><br/>        <tr><br/>            <td>&nbsp;</td><br/>            <td>&nbsp;</td><br/>        </tr><br/>        <tr><br/>            <td>&nbsp;</td><br/>            <td>&nbsp;</td><br/>        </tr><br/>    </tbody><br/></table><br/><p>&nbsp;<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:
Code:

<p>&nbsp; </ p>
Back to top
View user's profile Send private message
IceFrog
Smarty Rookie


Joined: 16 Dec 2008
Posts: 13

PostPosted: Fri Dec 26, 2008 11:34 pm    Post subject: Reply with quote

hm I fix first problem
Code:
$redtextcont = str_replace("\n","",$redtextcont);
Back to top
View user's profile Send private message
muhammad
Smarty Rookie


Joined: 07 May 2009
Posts: 5

PostPosted: Thu May 07, 2009 11:08 am    Post subject: Plugin for FCKeditor Reply with quote

Hi gzoot, plz tell me where to include the code given.
Back to top
View user's profile Send private message
muhammad
Smarty Rookie


Joined: 07 May 2009
Posts: 5

PostPosted: Thu May 07, 2009 11:14 am    Post subject: Fck Plugin By Gzoot Reply with quote

plz tell me where to inlude the code given
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Plugins All times are GMT
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP