News links to external URLs?
-
bawbgale
News links to external URLs?
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?
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.
-
bawbgale
Re: News links to external URLs?
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?
-
bawbgale
Re: News links to external URLs?
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
{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

