
Hansaardappel
User
Mar 18, 2010, 10:26 AM
Post #4 of 6
(4024 views)
Shortcut
|
|
Re: [chris] Question concerning Chris' subcategory tutorial
[In reply to]
|
Can't Post
|
|
That worked great Chris, thanks. I've got a new problem though I'm currently working on adding articles to multiple categories, I changed the list to multi value and chose the appropriate categories for my articles. Displaying articles that only belong to a single category still works fine, but I'm having some problems with articles that belong to multiple categories. There's this one article, that belongs to category "Tournament Results" (Parent category (num=1)), "Indian Wells" (sub category of Tournament Results (num=2)) and to "Roger Federer" (Parent category (num=3)). What I want to do is to only display the articles within category "Roger Federer". My code: list($categoriesRecords, $selectedCategory) = getCategories(array( 'tableName' => 'categories', 'categoryFormat' => 'onelevel', )); list($articlesRecords, $articlesMetaData) = getRecords(array( 'tableName' => 'articles', 'perPage' => '5', 'where' => 'category = 3', )); // Display code <?php foreach ($articlesRecords as $record): ?> <?php echo $record['content'] ?><br/> <?php endforeach; ?> <?php if (!$articlesRecords): ?> No records were found!<br/><br/> <?php endif ?> Other articles in the category are being displayed fine, but not this specific article. When I remove the article from the other categories, so that the category "Roger Federer" is the only one it belongs to, it DOES get displayed. What am I doing wrong?
|