News summary - summary length and moretext positiom

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
HoofArted
Forum Members
Forum Members
Posts: 26
Joined: Sun Jul 22, 2012 1:11 am

News summary - summary length and moretext positiom

Post 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? :)
pete290
Forum Members
Forum Members
Posts: 54
Joined: Sat Aug 22, 2009 5:55 pm

Re: News summary - summary length and moretext positiom

Post 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>
HoofArted
Forum Members
Forum Members
Posts: 26
Joined: Sun Jul 22, 2012 1:11 am

Re: News summary - summary length and moretext positiom

Post by HoofArted »

Ty, I will give it a try.

2. Seems lika strip_tags does the job... :)
HoofArted
Forum Members
Forum Members
Posts: 26
Joined: Sun Jul 22, 2012 1:11 am

Re: News summary - summary length and moretext positiom

Post by HoofArted »

Ok, ran into a different kind of problem - when using truncate, it doesn't show any image included. Any solution to this?
pete290
Forum Members
Forum Members
Posts: 54
Joined: Sat Aug 22, 2009 5:55 pm

Re: News summary - summary length and moretext positiom

Post 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.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: News summary - summary length and moretext positiom

Post 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...
HoofArted
Forum Members
Forum Members
Posts: 26
Joined: Sun Jul 22, 2012 1:11 am

Re: News summary - summary length and moretext positiom

Post 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.
Jean le Chauve

Re: News summary - summary length and moretext positiom

Post 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
HoofArted
Forum Members
Forum Members
Posts: 26
Joined: Sun Jul 22, 2012 1:11 am

Re: News summary - summary length and moretext positiom

Post by HoofArted »

Thank you, I shall try that.
Jean le Chauve

Re: News summary - summary length and moretext positiom

Post 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}
Post Reply

Return to “Modules/Add-Ons”