Page 1 of 1

News summary - summary length and moretext positiom

Posted: Wed Aug 08, 2012 12:26 pm
by HoofArted
Hi.

I have to questions:

1. Where do I set the text limit for the summary field? By default it seems all the text I enter is shown in frontend news summary.

2. I would like the more link would be in the same line as the summary text, right after the text. However if I use <p>text</p>, it is below the text (of course only following css rules...). I could always write with no paragraphs using <br>, but the problem is that a secretary will be posting news and I would like to make it bulletproof. Is there any way around to include more link before last </p>?

I am using:

CMS Version 1.10.3
MicroTiny 1.1.1
News 2.12.3


EDIT: or I set her TinyMCE and hope it keeps default <br> forever? :)

Re: News summary - summary length and moretext positiom

Posted: Wed Aug 08, 2012 1:16 pm
by pete290
1.You can set limit in templates see http://www.i-do-this.com/blog/17/Shorte ... h-truncate for useful info. You can also disable summary so they don't have to enter stuff twice.

2.Try using <span></span>

Re: News summary - summary length and moretext positiom

Posted: Wed Aug 08, 2012 4:24 pm
by HoofArted
Ty, I will give it a try.

2. Seems lika strip_tags does the job... :)

Re: News summary - summary length and moretext positiom

Posted: Wed Aug 08, 2012 5:21 pm
by HoofArted
Ok, ran into a different kind of problem - when using truncate, it doesn't show any image included. Any solution to this?

Re: News summary - summary length and moretext positiom

Posted: Wed Aug 08, 2012 6:45 pm
by pete290
Truncate doesn't have an effect on images - You can include images by inserting straight into editor or creating an extra image field - which must then be called in template.

Re: News summary - summary length and moretext positiom

Posted: Wed Aug 08, 2012 6:51 pm
by Dr.CSS
The truncate counts characters then cuts it off, the image must be on the less side of the character count to show, this will mean that the secretary will have to count how many characters they are inputting to know where the image goes...

Sounds like it would be easier to tell them not to put so much in the Summary, since they will have to keep count anyways, and not use truncate...

Re: News summary - summary length and moretext positiom

Posted: Wed Aug 08, 2012 7:25 pm
by HoofArted
pete290 wrote:Truncate doesn't have an effect on images - You can include images by inserting straight into editor or creating an extra image field - which must then be called in template.
Yup, the problem apparently is the strip_tags atribute in smarty, which clears img atributs as it seems...

Maybe any tip on how tp creat an extra image field? Basically inserting it via wysiwyg editor works for my case as long as I can get it to show in news.

Re: News summary - summary length and moretext positiom

Posted: Wed Aug 08, 2012 8:39 pm
by Jean le Chauve
Summary template

Code: Select all

{foreach from=$entry->fields item='field'}

 {if $field->name == 'image' && $field->value neq ''}
       {capture assign='photoarticle'}uploads/news/id{$entry->id}/{$entry->fields.image->value}{/capture}<a href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}" class="alignleft">{cms_module module="CGSmartImage" alias='miniature_news' src=$photoarticle alt=$entry->title class="alignleft"}</a>
{elseif $field->name == 'imagePicker' && $field->value neq ''}
         {capture assign='photopicker'}{eval var=$entry->fields.imagePicker->value|regex_replace:'#<img\ssrc=\"(.*)\"\salt=\".*\"\swidth=\".*\"\sheight=\".*\"\s/>#':'$1'}{/capture}
<a href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}" class="alignleft">
  {cms_module module="CGSmartImage" alias='miniature_news' src=$photopicker alt=$entry->title class="alignleft"}  </a>      
{/if}
{/foreach}
You need CGSMartImage and you must configure an alias
You create 2 custom fields :
1) image, type file (upload from your pc)
2) imagePicker, type textarea (upload from the wisiwig an existing image)
The user can choose only one

Re: News summary - summary length and moretext positiom

Posted: Thu Aug 09, 2012 12:54 pm
by HoofArted
Thank you, I shall try that.

Re: News summary - summary length and moretext positiom

Posted: Fri Aug 10, 2012 4:36 pm
by Jean le Chauve
Beter this :

Code: Select all

{foreach from=$entry->fields item='field'}
 {if $field->name == 'image' && $field->value neq ''}
       {capture assign='photoarticle'}uploads/news/id{$entry->id}/{$field->value}{/capture}<a href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}" class="alignleft">{cms_module module="CGSmartImage" alias='miniature_news' src=$photoarticle alt=$entry->title class="alignleft"}</a>
{elseif $field->name == 'imagePicker' && $field->value neq ''}
         {capture assign='photopicker'}{eval var=$field->value|regex_replace:'#<img\ssrc=\"(.*)\"\salt=\".*\"\swidth=\".*\"\sheight=\".*\"\s/>#':'$1'}{/capture}
<a href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}" class="alignleft">
  {cms_module module="CGSmartImage" alias='miniature_news' src=$photopicker alt=$entry->title class="alignleft"}  </a>      
{/if}
{/foreach}
{$entry->fields.image->value} become {$field->value}