Displaying news module detail content on a page

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"
Locked
tonyg

Displaying news module detail content on a page

Post by tonyg »

Can anyone tell me how to get a page to display all of the detail news items from the news module?

I have a content page called "Latest News". I use {cms_module module="news" number="3"} to display the news summaries on the site home page. When a user clicks "More", I want them redirected to the Latest News page, which should display the detail of all the news items (no summaries).

Is there a variation of the module="news" command I can use for this? Or do I need to duplicate and rehash the news module? If I have to do that, how do I do it? I can modify PHP and templates.

TonyG
Brisbane, Australia
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm

Re: Displaying news module detail content on a page

Post by tsw »

Im not sure if there is an option for showing multiple news like that. please read the help text for news module carefully.

if there is no such option you can write it. first save a backup of all the files and just edit the news module code, add a new parameter for it (something like show_full_news_not_summaries :) and test your changes thoroughly. after you have a working solution it would be nice to share it so you can do a diff between original and edited versions and send it to forge, or better yet checkout the latest svn version (it might not work with 0.13 tho) and use it to do the editing.

Hope this helps
tonyg

Re: Displaying news module detail content on a page

Post by tonyg »

Thanks for the advice, but I am not sure I know where to find the help text for the news module. All I have seen is a page with parameters explained. I have been searching for more, but not finding it.

Can I simply copy the news module and rename it to, say, "news_tony", install it as a new module and modify the templates? Can I then call it as module='news-tony'?

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

Re: Displaying news module detail content on a page

Post by tsw »

tonyg wrote: Thanks for the advice, but I am not sure I know where to find the help text for the news module. All I have seen is a page with parameters explained. I have been searching for more, but not finding it.
That would be the help (you can also look in the wiki for more help)
tonyg wrote: Can I simply copy the news module and rename it to, say, "news_tony", install it as a new module and modify the templates? Can I then call it as module='news-tony'?
not quite, you'll also need to change the module name.

but if you only want to edit the template news module has the option summarytemplate="" and detailtemplate="" (youll have to create template files in the module folder iirc)
tonyg

Re: Displaying news module detail content on a page

Post by tonyg »

I don't know if you've ever looked at it, but the help for the news module (both in the help file and in the wiki) is not very good. There are parameters mentioned, with brief descriptions, but no examples of how to use them. There is no real information about the templates, except in the context of modding them for a blog.

Before I go too far, I wonder if the simple solution is to add a {foreach from=$items item=entry} to the detail template?

Tony
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Displaying news module detail content on a page

Post by Dr.CSS »

You need to make a new template and call in the tag, make it from the detail template copy/paste and take out the things you don't want like {eval var=$entry->summary} just taking that part out and not the whole line, make sure to put .tpl on the end...

{cms_module module="news" summarytemplate='yournewtemplate.tpl'}

Put this on another page set to not show in menu then in the page with summaries this tag...

{cms_module module="news" number="3" detailpage='pagealias'}

detailpage="pagealias" - Page to display News details in. This can either be a page alias or an id. Used to allow details to be displayed in a different template from the summary.

The page alias or id is the page the first tag is in.
Locked

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