dynamic categories

Japio
Member
Beiträge: 46
Registriert: Di 21. Jul 2009, 12:13

dynamic categories

Beitragvon Japio » Di 5. Jan 2010, 09:59

Hi,

I have the following listview:
<we:listview type="object" name="kandidaatlist" categories="/Noord-Holland/Aalsmeer" classid="9">

I would like to use a dynamic categorie instead of pre-defining the categorie. It would take to much templates this way.
So something like categories="$category"

Can anyone help me out with this one?

Thanks,
Japio

we:willRockYou
Senior Member
Beiträge: 919
Registriert: Fr 22. Mai 2009, 21:40
Wohnort: Berlin
Kontaktdaten:

Re: dynamic categories

Beitragvon we:willRockYou » Di 5. Jan 2010, 10:05

Hi Japio,

sure, just add a slash before the $ to escape it.

categories="\$category"

Regards,
Daniel

Japio
Member
Beiträge: 46
Registriert: Di 21. Jul 2009, 12:13

Re: dynamic categories

Beitragvon Japio » Di 5. Jan 2010, 10:10

Daniel,

Thanks for the quick reply. The document has a category assigned to it. How can i display only the objects with this category?

Japio
Member
Beiträge: 46
Registriert: Di 21. Jul 2009, 12:13

Re: dynamic categories

Beitragvon Japio » Di 5. Jan 2010, 10:25

Sorry, allready fixed it.

Japio
Member
Beiträge: 46
Registriert: Di 21. Jul 2009, 12:13

Re: dynamic categories

Beitragvon Japio » Do 14. Jan 2010, 18:18

It looks like it's not working the same in all listviews. I used the following code to determine the categorie assigned to a document:
<?php
$categories = (string) $GLOBALS['we_doc']->Category;
$a_categories = explode(',', $categories);
$aa_categories = array_slice($a_categories, 1, -1);
$categories = $a_categories['1'];

$sql = (string) "SELECT Path FROM tblCategorys WHERE ID = '$categories'";
$ThisCat = (string) f($sql, 'Path', $GLOBALS['DB_WE']);
?>

And this is my listview:
<we:listview type="object" name="kandidaatlist" categories="\$ThisCat" classid="9">

Some pages display the right amount of objects and others don't. What could be the problem?

Thanks,
Japio

Liquid
Senior Member
Beiträge: 1172
Registriert: Do 8. Jan 2004, 12:31
Wohnort: Karlsruhe

Re: dynamic categories

Beitragvon Liquid » Fr 15. Jan 2010, 15:26

Are ther objects with multiple categories?!
If so, the option catOr="true|false" may help, i think the default behavior is catOr="false"
Gruß Liquid


Zurück zu „DB / Object Module“

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 6 Gäste