Format text of description in listings

Questions and answers about change of functions, design, hosting etc.

Moderators: Koduc, Xpycm

Forum rules
Pay attention! Forum is not a means for guaranteed support of clients and users. An answer as well as a quick answer is not supposed on the forum. We post messages as soon as possible.

The message limit on the forum is 3 messages per day.
If you want to say "thank you" then use the function "Give good reputation point", which is a green icon "plus" under the nickname of the person, who answered the message.

Format text of description in listings

Postby ijturner » 10 Jun 2013, 03:07

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?
ijturner
Stranger
 
Posts: 3
Joined: 06 Jun 2013, 10:14
Reputation point: 0

Re: Format text of description in listings

Postby Xpycm » 10 Jun 2013, 06:58

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
Dropbox
Open Real Estate CMS: FAQ | FAQ 2 | FAQ 3
Image
Xpycm
Web Developer
Web Developer
 
Posts: 281
Joined: 30 Dec 2011, 11:06
Reputation point: 2

Re: Format text of description in listings

Postby ijturner » 13 Jun 2013, 03:37

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?
ijturner
Stranger
 
Posts: 3
Joined: 06 Jun 2013, 10:14
Reputation point: 0

Re: Format text of description in listings

Postby Xpycm » 13 Jun 2013, 07:07

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>';
}
 
Dropbox
Open Real Estate CMS: FAQ | FAQ 2 | FAQ 3
Image
Xpycm
Web Developer
Web Developer
 
Posts: 281
Joined: 30 Dec 2011, 11:06
Reputation point: 2

Re: Format text of description in listings

Postby ijturner » 14 Jun 2013, 03:38

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.
ijturner
Stranger
 
Posts: 3
Joined: 06 Jun 2013, 10:14
Reputation point: 0


Return to Questions and help for changes

Who is online

Users browsing this forum: No registered users and 47 guests