How to program a dynamic sub menu based on a categories field in a WE document?
[original entry http://forum.webedition.de/showthread.php?t=9462]
Site section called "News" - you can view current development templates here http://eciia.ssi.eu.com/news/index.php
At present I have setup a series of categories for the news articles - thus when I go to build the pages I am able to view the category in the biscuit on the details page. For example
http://eciia.ssi.eu.com/news/2004/2004-09-29.php
Shows >> Home > News > ECIIA > Coso ERM Published [i.e. category "ECIIA"]
i.e.
>> Home > News > $Category > $Title
To complete my work on this section I would like some sub navigation on http://eciia.ssi.eu.com/news/index.php under my search box, example:
European News
- International
- General
- Minutes
- Other
i.e.
$Cat1
$Cat2
$Cat3
etc.
Then when you click on a link i.e. $Cat1 you will go to a filtered list of news articles on that category before selecting the article interested.
Can anyone tell me
a) How is this is possible using weTags?
b) Or do I need to hand code this?
In either case are there any tutorials for this online/starting points?
I presume that this has been done many times before and would like to avoid re-inventing the wheel.
Thanks in advance
Regards, Tim
(forum user "ssiweb", original entry http://forum.webedition.de/showthread.php?t=9462)
dynamic categorized submenu entries
Hi,
a very "basic" solution would be the we:category select tag, but I don't think it fits your needs.
In your case there would be two steps:
1) get a list of categories from database to display as subnavigation.
2) get a filtered result.
The filtered result should be quite easy:
sub navigation:
<a href="newslist.php?category=examplecategory"/>
=> use PHP urlencode function to encode strings if you want to use them as url parameter. See http://www.php.net/urlencode
In template for newslist.php:
<?php
// First we check if there's a value given or
// use default value if not
if (isset($_REQUEST['category'])) {
$my_cat = $_REQUEST['category'];
} else {
$my_cat = 'Default Category Name';
}
?>
.. and in we:listview
<we:listview type="document" category="$my_cat">
...
a very "basic" solution would be the we:category select tag, but I don't think it fits your needs.
In your case there would be two steps:
1) get a list of categories from database to display as subnavigation.
2) get a filtered result.
The filtered result should be quite easy:
sub navigation:
<a href="newslist.php?category=examplecategory"/>
=> use PHP urlencode function to encode strings if you want to use them as url parameter. See http://www.php.net/urlencode
In template for newslist.php:
<?php
// First we check if there's a value given or
// use default value if not
if (isset($_REQUEST['category'])) {
$my_cat = $_REQUEST['category'];
} else {
$my_cat = 'Default Category Name';
}
?>
.. and in we:listview
<we:listview type="document" category="$my_cat">
...
Wer ist online?
Mitglieder in diesem Forum: 0 Mitglieder und 3 Gäste