Override details URL in news summaries

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
User avatar
kermit
Power Poster
Power Poster
Posts: 693
Joined: Thu Jan 26, 2006 11:46 am

Override details URL in news summaries

Post 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'}
eternity (n); 1. infinite time, 2. a seemingly long or endless time, 3. the length of time it takes a frozen pizza to cook when you're starving.
4,930,000,000 (n); 1. a very large number, 2. the approximate world population in 1986 when Microsoft Corp issued its IPO. 3. Microsoft's net profit (USD) for the quarter (3 months) ending 31 March 2007.
CMSMS migration and setup services | Hosting with CMSMS installed and ready to go | PM me for Info
Post Reply

Return to “Tips and Tricks”