>More Link in News to turn off if no content...

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
User avatar
Darwin Web Design
Forum Members
Forum Members
Posts: 212
Joined: Tue May 30, 2006 3:12 am

>More Link in News to turn off if no content...

Post by Darwin Web Design »

Hi there
This post is very similar to one I made last week at http://forum.cmsmadesimple.org/index.ph ... 896.0.html - but it was for the Calendar Module.

What I want to do is have a news summary on my home page - if the news is lengthy, i would like it to link to the full page story as it does by default anyway.  BUT if it is only short - ie a few lines, I don't want to link to another page at all - and remove the >more link (and link in the title).  I have noticed if you don't insert any text in the content area it doesn't let you post the news item though - hope this isn't a problem... or there is an easy way around...

I have applied the code that someone gave to me from my previous post to the calendar module for this same effect but as it all looks like another language to me I can't work out how to apply this same concept to the news module...  which lies my request for someone's help...  ::)

My news summary template looks like this:

***

{foreach from=$items item=entry}

{$entry->titlelink}
{if $entry->summary}
{eval var=$entry->summary}

[{$entry->morelink}]


{else if $entry->content}

{eval var=$entry->content}
{/if}
{/foreach}

***

Thanks
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm

Re: >More Link in News to turn off if no content...

Post by tsw »

did you read news module help?

this page has the default news templates in use

http://tsw.backspace.fi/svn/

only thing I changed was the template to show 4items instead of three so that all possible combinations can be shown. (well actually I think there are three more but still)

if you only fill the content field there will be no more link and everything is in the news box.

if you fill content and summary fields summary will be in the news box and it will have a more link to content.

only thing not covered by this test is a long summary + long content. in that case I think that long summary will be cut automatically at about 300characters (but dont quote me on that)

so what you want is already the default behaviour

its the summary field you need to leave blank if you dont want a link.

(see the * markings next to fields, they denote mandatory fields).
User avatar
Darwin Web Design
Forum Members
Forum Members
Posts: 212
Joined: Tue May 30, 2006 3:12 am

Re: >More Link in News to turn off if no content...

Post by Darwin Web Design »

Thank you

I don't see that explanation in the help (I'm using 0.13...) but I've tried what you say and it works brilliantly.  I was inserting my text in the wrong box.

With the short news article, is there a way to turn off the link in the heading (because it doesn't actually link to a longer story)...

Thanks again, appreciate it.

;D
Last edited by Darwin Web Design on Tue Nov 14, 2006 10:07 pm, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: >More Link in News to turn off if no content...

Post by Dr.CSS »

You will need to change the template using just the title tag to {$entry->title} in place of the {$entry->titlelink}...
User avatar
Darwin Web Design
Forum Members
Forum Members
Posts: 212
Joined: Tue May 30, 2006 3:12 am

Re: >More Link in News to turn off if no content...

Post by Darwin Web Design »

Thanks Mark, sounds easy - will give it a go.  :)
Post Reply

Return to “Layout and Design (CSS & HTML)”