Page 1 of 1

Format text of description in listings

PostPosted: 10 Jun 2013, 03:07
by ijturner
How can I format the text in the listing description so that it includes bold, carriage returns, images etc . I have added ckeditor to my folders but can't work where to insert it?

Re: Format text of description in listings

PostPosted: 10 Jun 2013, 06:58
by Xpycm
ckeditor is already included in ORE (protected\extensions\ckeditor folder) - http://www.yiiframework.com/extensions/?tag=ckeditor
use:
Code: Select all
<?php
    $this
->widget('application.modules.lang.components.langFieldWidget', array(
        
'model' => $model,
        
'field' => '_name_of_attribute_',
        
'type' => 'text-editor'
    
));
?>


and CHtml::decode($model->_name_of_attribute_) in view

Re: Format text of description in listings

PostPosted: 13 Jun 2013, 03:37
by ijturner
Thanks for the reply. I am still not sure where to put this code to upgrade the listing description field. What file in what folder?

Re: Format text of description in listings

PostPosted: 13 Jun 2013, 07:07
by Xpycm
For example, the paid version
Before: https://www.dropbox.com/s/7v5x8b866agzw ... 030_01.png
After: https://www.dropbox.com/s/v7ldajtf34klu ... 030_02.png

For this:

1) Open protected/modules/apartments/views/backend/__form.php file
instead of:
Code: Select all
<?php
$this
->widget('application.modules.lang.components.langFieldWidget', array(
    'model' => $model,
    'field' => 'description',
    'type' => 'text'
));
?>

write:
Code: Select all
<?php
$this
->widget('application.modules.lang.components.langFieldWidget', array(
    
'model' => $model,
    
'field' => 'description',
    
'type' => 'text-editor'
));
?>


2) Open protected/modules/apartments/views/_view.php file
instead of:
Code: Select all
if($data->getStrByLang('description')){
    echo '<p><strong>'.tt('Description').':</strong> '.CHtml::encode($data->getStrByLang('description')).'</p>';
}
 

write:
Code: Select all
if($data->getStrByLang('description')){
    echo '<p><strong>'.tt('Description').':</strong> '.CHtml::decode($data->getStrByLang('description')).'</p>';
}
 

Re: Format text of description in listings

PostPosted: 14 Jun 2013, 03:38
by ijturner
Thanks for your help. It works well.
It should be this way in the original Open Realty as the description is the most important part.