Loading...
 
Features / Usability

Features / Usability


Categories not showing on Wiki page category listing

posts: 224 Ireland

Hi all,

Using Tiki 1.8.4, I am facing following problem. There seems to be inconsistent display of category items in the category bar at the bottom of each Wiki page. For e.g.: when adding a wiki page '123' to category 'ABC' and also adding file gallery 'XYZ' to the same category 'ABC', then the entry for the file gallery does not show up in the category listing on the wiki page '123'. However, when browing through the category 'ABC' using the category browser then both items are displayed.

The behaviour seems to be erratic, sometimes it works, sometimes it doesn't.

Any ideas what is going on here?

Regards,

pat.

posts: 224 Ireland

I found the problem myself in the get_categoryobjects() function in lib/tikilib.php. This routine contains following snippet:

foreach ($objectcat["data"] as $obj) {
            $type = $obj["type"];
            if (!($this->in_multi_array($obj['name'], $listcat))) {
                if (isset($typetitles["$type"])) {
                    $listcat["{$typetitles["$type"]}"][] = $obj;
                } elseif (isset($type)) {
                    $listcat["$type"][] = $obj;
                }
            }
        }


The check to remove duplicates on line 3 is bogus because it can very well be for category objects of different types - e.g. file gallery or wiki page - to have the same name. Name is not a good unique identifier which explains also why the problem wasn't always happening as I didn't have naming conflicts across all categories.

I don't think it is otherwise possible to add duplicate objects of the same name and type to the category tables so I would say this check can be eliminated all together. It works for me anyway.

Corrected code:

foreach ($objectcat["data"] as $obj) {
            $type = $obj["type"];
            if (isset($typetitles["$type"])) {
                $listcat["{$typetitles["$type"]}"][] = $obj;
            } elseif (isset($type)) {
                $listcat["$type"][] = $obj;
            }
        }

Upcoming Events

No records to display

Menu