FCKEditor et Cake

http://bakery.cakephp.org/articles/view/using-fckeditor-with-cakephp

http://www.fckeditor.net/download … todo

moi j'ai dû un peu bidouiller fck.php

<?php 
class FckHelper extends Helper
{
	function load($did, $toolbar = 'Default') {
		/*foreach (explode('/', $id) as $v) {
	 		$did .= ucfirst($v);
		}
*/

		$serveur= $_SERVER["HTTP_HOST"];
if($serveur=="localhost") { //serveur de développement
$CHEMIN="cake";
} elseif ($serveur=="truc.chose.ch"){ //serveur de prod
$CHEMIN="tools/cake";
}
		return <<<FCK_CODE
<script type="text/javascript">
fckLoader_$did = function () {
    var bFCKeditor_$did = new FCKeditor('$did');
    bFCKeditor_$did.BasePath = '/$CHEMIN/js/';
    bFCKeditor_$did.ToolbarSet = '$toolbar';
    bFCKeditor_$did.ReplaceTextarea();
}
fckLoader_$did();
</script>
FCK_CODE;
	}
}

/*
good?
fckLoader_$did = function () {
    var bFCKeditor_$did = new FCKeditor('$did');
    bFCKeditor_$did.BasePath = '/cake/js/';
    bFCKeditor_$did.ToolbarSet = '$toolbar';
    bFCKeditor_$did.ReplaceTextarea();
}
fckLoader_$did();

work
var oFCKeditor = new FCKeditor('FCKeditor1');
oFCKeditor.BasePath = "/cake/js/";
oFCKeditor.Create();

*/
?>


et dans edit.ctp j'ai aussi magouillé:

<?php 
#echo $javascript->link('cake/fckeditor'); 
echo $javascript->link('fckeditor'); 
?> 
<div class="remarques form">
<?php echo $form->create('Remarque');?>
	<fieldset>
 		<legend><?php __('Edit Remarque');?></legend>
	<?php
		echo $form->input('login');
		echo $form->input('type');
		echo $form->input('id_source');
echo $form->input('rem');
echo $fck->load('RemarqueRem');
		echo $form->input('date');
		echo $form->input('id');
	?>
	</fieldset>
<?php echo $form->end('Submit');?>
</div>

<div class="actions">
	<ul>
		<li><?php echo $html->link(__('Delete', true), array('action'=>'delete', $form->value('Remarque.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $form->value('Remarque.id'))); ?></li>
		<li><?php echo $html->link(__('List Remarques', true), array('action'=>'index'));?></li>
	</ul>
</div>
  • info/cakefckeditor.txt
  • Dernière modification: 2018/07/18 09:45
  • par radeff