[solved] show latest items of multiple categories in News Module
[solved] show latest items of multiple categories in News Module
Hey Guys,
I was wondering. It's probably possible, but dont really now how. But is it possible (like in the browse cat template) show a listing of all the categories and 3 of their items. I would prefer to make a fully automatic. Thats alot easier for my client, i could ofcourse put all 12 summarytemplates of em in the page, but it would be easier if it automatically refills as soon as they add a new categorie.
tnx
david
I was wondering. It's probably possible, but dont really now how. But is it possible (like in the browse cat template) show a listing of all the categories and 3 of their items. I would prefer to make a fully automatic. Thats alot easier for my client, i could ofcourse put all 12 summarytemplates of em in the page, but it would be easier if it automatically refills as soon as they add a new categorie.
tnx
david
Last edited by davidjon on Mon Nov 30, 2009 10:29 pm, edited 1 time in total.
Re: show latest items of multiple categories in News Module
just to make it extra clear. Im talking about a block with the Categoryname as Title and then the newstitle links. For each categorie a new block so..
Re: show latest items of multiple categories in News Module
You need to create summary template that shows news title-links and and new browse category template that will show all root categories and up to 3 news for each category.
Everything else depends on exact your needs.
EDIT: I named new browse category template "test" and called news module in page as follows:
Code: Select all
{if $count > 0}
<ul class="list1">
{foreach from=$cats item=node}
{if $node.depth==1}
<li class="newscategory">
<span>
{$node.news_category_name}
{capture assign='temp'}{$node.news_category_name} | *{/capture}
{news number='3' summarytemplate='simple_list' category=$temp }
</span>
</li>
{/if}
{/foreach}
</ul>
{/if}
EDIT: I named new browse category template "test" and called news module in page as follows:
Code: Select all
{news action=browsecat browsecattemplate=test }
Last edited by Peciura on Thu Nov 19, 2009 10:22 pm, edited 1 time in total.
Re: show latest items of multiple categories in News Module
wow! f** nice....thanks it works...i actually found a way accidentaly, but later on i changed something again and it didnt work anymore:( and could think of how i did it....
but i think this will work fine
tnx mate
but i think this will work fine

tnx mate
Re: show latest items of multiple categories in News Module
ooo, forgot one thing.
I know selected {news category="name | child*"} for the browsecat temp. The only problem is that it adds CHild to the list, and I only want to show the childeren of CHILD..is there a workaround for this?
I know selected {news category="name | child*"} for the browsecat temp. The only problem is that it adds CHild to the list, and I only want to show the childeren of CHILD..is there a workaround for this?
Re: show latest items of multiple categories in News Module
These are 3 different meanings:
1. show node and it's children "*"
2. show children only " | *"
3. is "*" variable modifier
"|*"
1. show node and it's children "*"
Code: Select all
{news category="name | child*"}
Code: Select all
{news category="name | child | *"}

Code: Select all
{news category="name | child|*"}
Re: show latest items of multiple categories in News Module
I've working on this site again...
thanks for the explanation. However im bumping in to an issue
The code for the first one is :
{news action="browsecat" browsecat="1" category="Activiteiten | Particulieren |*" sortby="random" detailpage="detail-bo"}
The code for the second one is :
{news action="browsecat" browsecat="1" category="Activiteiten | Basis Onderwijs | *" sortby="random" detailpage="detail-bo"}
Both of em have a child categorie named Sport.
And now they're Showing items in both categories....
i take it this shouldnt happen? can you help me fix this please?!
thanks for the explanation. However im bumping in to an issue
The code for the first one is :
{news action="browsecat" browsecat="1" category="Activiteiten | Particulieren |*" sortby="random" detailpage="detail-bo"}
The code for the second one is :
{news action="browsecat" browsecat="1" category="Activiteiten | Basis Onderwijs | *" sortby="random" detailpage="detail-bo"}
Both of em have a child categorie named Sport.
And now they're Showing items in both categories....
i take it this shouldnt happen? can you help me fix this please?!
Re: show latest items of multiple categories in News Module
Post page link , template you are using and category hierarchy list to forum. And i will look how i can help you.
Re: show latest items of multiple categories in News Module
Thanks that you're willing to help..
Ok here it comes....
The link to my site (in Dutch),
http://da.stylique.nl
If you go to the page 'Onderwijs' (Education), you'll get submenu. I only made the first two with the category list. So if you click on these. You'll see all the blocks which should contain items in it. Not all of em tho, i havnt had time yet, and first want I to sort out this problem.
If you look at the 2nd boxes for each page, you'll see that it contains the item 'Schilderen' (painting) twice. This is because I both added it to the category 'Activiteiten | Basis Onderwijs | Creatief ' & to 'Activiteiten | Jongeren | Creatief '. However when you click on the button 'Meer' (MORE) on the bottom of those blocks, you'll only see the orginal containing Item.
So this is the big main issue.
The structure of my News category is as following

This is the browse category template
This is the corresponding summarytemplate
These two templates make up the Main pages. and they get called by the tags
The code for the summary view once you click on MORE is :
and the Detailed template is :
I'm bumping in to another issue tho. As you can see, i made a page title in the Detail Template, with a 'breadcrumb to the category' next to it. I think i fix stuff with the smarty replace tag, but i was wondering if it's possible to replace multiple things in one tag. Since I have to replace the SPACE for a -, and sometimes i'll have to replace the ' & ' for a stripe. Do you know if this is possible, that would help me out alot, because I need to keep my category names like this, but they dont always match the page alias I want to link it to.
Well I hope this is enough info for ya,
Thanks alot for your time and effort, i hope this can be solved
tnx mate
DJ.
Ok here it comes....
The link to my site (in Dutch),
http://da.stylique.nl
If you go to the page 'Onderwijs' (Education), you'll get submenu. I only made the first two with the category list. So if you click on these. You'll see all the blocks which should contain items in it. Not all of em tho, i havnt had time yet, and first want I to sort out this problem.
If you look at the 2nd boxes for each page, you'll see that it contains the item 'Schilderen' (painting) twice. This is because I both added it to the category 'Activiteiten | Basis Onderwijs | Creatief ' & to 'Activiteiten | Jongeren | Creatief '. However when you click on the button 'Meer' (MORE) on the bottom of those blocks, you'll only see the orginal containing Item.
So this is the big main issue.
The structure of my News category is as following
This is the browse category template
Code: Select all
{if $count > 0}
{foreach from=$cats item=node}
<div class="smallBlock">
<div class="blockHeader"><h2>{$node.news_category_name}</h2></div>
<div class="blockContent">
{if $node.count > 0}
{capture assign='temp'}{$node.news_category_name}{/capture}
{news number='3' action="default" summarytemplate="categorie_list" detailpage="detail-bo" category=$temp}
{/if}
</div>
<p class="blockFooter"><a href="bo/bo-{$node.news_category_name|replace:' ':'-'}">meer...</a></p>
</div>
{/foreach}
{/if}
Code: Select all
{foreach from=$items item=entry}
<div class="item" onclick="location.href='{$entry->moreurl}'"><div class="title">{$entry->title|cms_escape:htmlall}</div><img src="http://da.stylique.nl//uploads/images/small/{$entry->small_image}.jpg" /></div>
{/foreach}
Code: Select all
{news action="browsecat" browsecat="1" category="Activiteiten | Basis Onderwijs | *" sortby="random"}
Code: Select all
{news action="browsecat" browsecat="1" category="Activiteiten | Jongeren | *" sortby="random"}
The code for the summary view once you click on MORE is :
Code: Select all
<div class="blockColumn">
{foreach from=$items item=entry}
<div class="smallBlock">
<div class="blockHeader"><h2>{$entry->title|cms_escape}</h2></div>
<div class="blockContent">
<img src="uploads/images/small/{$entry->small_image}.jpg" />
<p> {eval var=$entry->content|truncate:350}</p>
</div>
<div class="blockFooter"><a href="{$entry->moreurl}">meer...</a></div>
</div>
{/foreach}
</div>
Code: Select all
{* set a canonical variable that can be used in the head section if process_whole_template is false in the config.php *}
{if isset($entry->canonical)}
{assign var='canonical' value=$entry->canonical}
{/if}
{assign var='detail_title' value=$entry->title}
<div class="xLargeContent">
<div class="xLargeBlock">
<div class="blockHeader">
<ul>
<li><h1 class="cufon">{$entry->title}</h1></li>
<li class="crumbs"><a href="{$entry->category}">{$entry->category}</a></li>
</ul>
</div>
<div class="blockContent">
<p>{$entry->content}</p>
</div>
<p class="blockFooter"></p>
</div>
</div>
<div class="xLargeContent">
<div class="xLargeBlock">
<div class="blockHeader"><h2 class="cufon">Meer informatie aanvragen</h2></div>
<div class="blockContent">
<p>{startExpandCollapse id="name" title="Vraag meer informatie aan"}{capture assign='defaultval'}{title}{/capture}{cms_module module='FormBuilder' form='contact' value_fld2='$defaultval'}{stopExpandCollapse}
</p>
</div>
<p class="blockFooter"></p>
</div>
</div>
Well I hope this is enough info for ya,
Thanks alot for your time and effort, i hope this can be solved

tnx mate
DJ.
Re: show latest items of multiple categories in News Module
Okay so I was a bit quick in asking the last question.
on the tag I just added |replace:' & ':'-'|replace:' ':'-'|lower and that works fine now.
I was thinking, i might know a workaround around the issue of multiple the items in different categories with the same name. It's very ugly i know. But what If i'd just name the second group of categories ......name-2 and then just simply add the smarty string thing, strip or replace to the header....i think it would work, its not the nices way however..
But ill wait on what you have to say.
again thanks for your time.
on the tag I just added |replace:' & ':'-'|replace:' ':'-'|lower and that works fine now.
I was thinking, i might know a workaround around the issue of multiple the items in different categories with the same name. It's very ugly i know. But what If i'd just name the second group of categories ......name-2 and then just simply add the smarty string thing, strip or replace to the header....i think it would work, its not the nices way however..
But ill wait on what you have to say.
again thanks for your time.
Re: show latest items of multiple categories in News Module
I think you need to use
"{capture assign='temp'}{$node.long_name}{/capture}" instead of
"{capture assign='temp'}{$node.news_category_name}{/capture}" in browse category template.
This way it would assign category like "Activiteiten | Jongeren | Creatief" instead of "Creatief" only and it will not show sibling categories (though this is an handy category functionality ).
If you inspect variable {$node} in browse category template you will see some thing like this:
"{capture assign='temp'}{$node.long_name}{/capture}" instead of
"{capture assign='temp'}{$node.news_category_name}{/capture}" in browse category template.
This way it would assign category like "Activiteiten | Jongeren | Creatief" instead of "Creatief" only and it will not show sibling categories (though this is an handy category functionality ).
If you inspect variable {$node} in browse category template you will see some thing like this:
Code: Select all
array(9) {
["news_category_id"]=> string(2) "72"
["news_category_name"]=> string(13) "International"
["hierarchy"]=> string(17) "00070.00071.00072"
["long_name"]=> string(45) "Activiteiten | Jongeren | Creatief"
["index"]=> int(27)
["count"]=> string(1) "1"
["prevdepth"]=> int(2)
["depth"]=> int(3)
["url"]=> string(125) "http://www.blablablabl..."
}
Re: show latest items of multiple categories in News Module
Wow!i'm dazzled....
thank you my friend...this seems to be it
kinda logic thoo....
How do i mark this [solved]? Just put in the subject line of my first message? Is that all i need to do?
thank you my friend...this seems to be it

How do i mark this [solved]? Just put in the subject line of my first message? Is that all i need to do?
Re: show latest items of multiple categories in News Module
Yes edit title of initial post.