Page 1 of 1
News links to external URLs?
Posted: Wed Aug 24, 2005 5:56 am
by bawbgale
I would like to use the News module for both news articles on my own site and links to news on other sites? I've checked out the Bookmarks module, but that doesn't quite do what I want because I want to intermix local and external articles within the same categories, and sort them by date. Does anyone know of a way to do that? Is there a way to put some conditional code in the summary template so that if the content of the article begins with "http" it uses that URL for the title link instead of linking to my local page?
Re: News links to external URLs?
Posted: Wed Aug 24, 2005 10:17 am
by Ted
You can do a lot of things with the summary template, including conditional code. It's a full
smarty template and allows for all kinds of good logic stuff.
Re: News links to external URLs?
Posted: Thu Aug 25, 2005 2:19 pm
by bawbgale
Thanks, wishy. I'm new to smarty. I quickly found the {if} syntax, but can't find any "left" function -- i.e. if the left 4 characters = "http".... Can you tell me (or point me to where I might learn) how to do that?
Re: News links to external URLs?
Posted: Thu Aug 25, 2005 4:33 pm
by Ted
Try {if $summary|truncate:4 == 'http'}
Re: News links to external URLs?
Posted: Thu Aug 25, 2005 5:29 pm
by bawbgale
I got it to work! Here's the final code:
{if $entry->content|truncate:4:"" == 'http'}
content}">{$entry->title}
{else}
{$entry->titlelink}
{/if}
I'm putting the URL in content instead of summary, because I still want to include summary text about the article even if the article itself is offsite.
Thanks a bunch!
- Bob