Link page 'x' <> news category 'x'
Link page 'x' <> news category 'x'
Hello, here is my problem: I want to open the list of news from category 'x' when I click on a certain page from the website (with alias = 'x'). In other words, the content of the page (with alias 'x') must be the list of summary news from category 'x'. Could you help me?
Re: Link page 'x' <> news category 'x'
Assuming page alias == category:
Assuming page alias != category:
Add content block to the page template:
(optional) category="category" - Used in the summary view to display only items for the specified categories. Use * after the name to show children. Multiple categories can be used if separated with a comma. Leaving empty, will show all categories.
Code: Select all
{news category=$page_alias}
Add content block to the page template:
Code: Select all
{content block="newscat" oneline=1 label="News category" assign="newscat"}
Code: Select all
{if !empty($newscat)}
{news category=$newscat}
{else}
{news}
{/if}
Re: Link page 'x' <> news category 'x'
Thanks a lot for your response! I still need some help.
In this website careersphysics.info there are 3 content pages - About, Consult and Work. Accordingly there are 3 news categories named alike. So there is 1 to 1 correspondence page <-> category.
My question was: Is it possible when I click on one of the pages (in the left sidebar), for example "About", to open the list of all news summaries from the respective category "About" as page content (in the middle bar)?
As if I have the news category browser in the left sidebar formatted as pages.
In this website careersphysics.info there are 3 content pages - About, Consult and Work. Accordingly there are 3 news categories named alike. So there is 1 to 1 correspondence page <-> category.
My question was: Is it possible when I click on one of the pages (in the left sidebar), for example "About", to open the list of all news summaries from the respective category "About" as page content (in the middle bar)?
As if I have the news category browser in the left sidebar formatted as pages.
Re: Link page 'x' <> news category 'x'
Yes, that's exactly what was written above, but note that the page ALIAS should be same as news CATEGORY.
Just paste
{news category=$page_alias}
in the content of the respective pages.
Note that the news module also has a category action. So you don't need to make it this way. You can create a category template in the News module and use that to create your 'menu'. IF your menu only consists of News categories. If you want other pages to show up too, it might be easier to stick to your plan.
Just paste
{news category=$page_alias}
in the content of the respective pages.
Note that the news module also has a category action. So you don't need to make it this way. You can create a category template in the News module and use that to create your 'menu'. IF your menu only consists of News categories. If you want other pages to show up too, it might be easier to stick to your plan.
Re: Link page 'x' <> news category 'x'
Yes, now it works. Thank you and happy Holidays!
-
- Power Poster
- Posts: 1049
- Joined: Wed Mar 19, 2008 4:54 pm
Re: Link page 'x' <> news category 'x'
please put [solved] before the title.