I am looking for something very easy - but I am unable to make it work.
I am looking for an option to reorganise a list of projects based on the categories or tags they are assigned to.
I read some articles and thought the tagcloud thing would best serve me but based on this article https://getkirby.com/docs/cookbook/tags , but I am unable to make it work.
When I implement this code, I get a list of ‘home’ and ‘page’ - which are not tags I have assigned to my projects…
Can anyone help me with this simple endeavour. A explanatory page is helpfull too but I have not found it yet. I have also tried the tagcloud plugin but that did not work either. Any kind help is appreciated!
Now the second part…
So, I should put such a code as below in projects.php?
That makes sense but the url goes to mysite/blog/tag:interior… is that correct? I would presume it then needs to be pasted in blog.php or tag.php… or am I missing something? (probably :))
<?php
if($tag = param('tag')) {
$projects = $site->page('projects')->children()->visible()->filterBy('tags', param('tag'), ',');
}
foreach($projects as $project) {
//list your $project
}
?>
Correct. I’d recommend that you make each tag on the frontpage a link to http://mysite/projects/tag:interior. Then in projects.php you apply the following logic:
If tag not set -> display all projects
If tag set but not found -> display a message that says "No projects with this tag"
If tag set & found -> Display the projects with that tag
Thanks!
Now the tags link correctfully to mysite/projects/tag:interior
However if I add that code of you guys in the projects.php the page goes blank. I am looking what could be the problem but I do not find it… I simplified the code to this and the afterwards a foreach loop is started but it goes blank…