Page 1 of 1

Override details URL in news summaries

Posted: Wed Jun 18, 2008 11:17 am
by kermit
If your site has separate pages for certain news items with different and/or extra content not found in the news item's details (or you want to link offsite for it), you can easily override the URL that the News module outputs in summary lists to point to that different page instead of the news module's internal URL.

This requires the News module that has custom field definitions (dunno when that was added; I'm working with CMSMS 1.3 here).

Create one called OverrideDetailsURL as type Text Input. Use that new custom field to enter the full URL (including the http://) that you want to use for any given news item. In a summary template, use something like this:

Code: Select all

{if $entry->overridedetailsurl neq ''}<a href="{$entry->overridedetailsurl}">{$entry->title}</a>{else}{$entry->titlelink}{/if}
to use that new URL instead of the auto-generated one.

On that separate page, if it's in CMSMS, you can simply call a details template using the articleid parameter if you want to include the actual details out of the News module as part of the different page's content...

Code: Select all

{cms_module module='news' articleid='4' action='detail' detailtemplate='news-itemdetails'}