Link page 'x' <> news category 'x'

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
sivanov
New Member
New Member
Posts: 4
Joined: Wed Dec 24, 2014 11:32 pm

Link page 'x' <> news category 'x'

Post by sivanov »

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?
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Link page 'x' <> news category 'x'

Post by velden »

Assuming page alias == category:
(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}
Assuming page alias != category:

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}
sivanov
New Member
New Member
Posts: 4
Joined: Wed Dec 24, 2014 11:32 pm

Re: Link page 'x' <> news category 'x'

Post by sivanov »

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.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Link page 'x' <> news category 'x'

Post by velden »

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.
sivanov
New Member
New Member
Posts: 4
Joined: Wed Dec 24, 2014 11:32 pm

Re: Link page 'x' <> news category 'x'

Post by sivanov »

Yes, now it works. Thank you and happy Holidays!
staartmees
Power Poster
Power Poster
Posts: 1049
Joined: Wed Mar 19, 2008 4:54 pm

Re: Link page 'x' <> news category 'x'

Post by staartmees »

please put [solved] before the title.
Post Reply

Return to “The Lounge”