[Solved] problem with showing tags list on pages

Post Reply
User avatar
Jay
Master Bludit
Posts: 133
Joined: Mon Feb 11, 2019 8:41 pm

I wanted to show categories and tags on hide'able menu in devtheme using

Code: Select all

<?php Theme::plugins('siteSidebar') ?>
On homepage everything works smooth as supposed.
The problem appears on pages, where I get errors with accessing the tags db

Code: Select all

Notice: Trying to get property 'db' of non-object in /bl-plugins/tags/plugin.php on line 43

Warning: Invalid argument supplied for foreach() in /bl-plugins/tags/plugin.php on line 43
It's weird, because categories works fine, and access to db file inside both tag and categories plugin.php is almost identical.

Is it more a theme problem (more a lack of including something in devtheme) or bludit's core?
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

How do you show the tags? With which code?
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
Jay
Master Bludit
Posts: 133
Joined: Mon Feb 11, 2019 8:41 pm

Edi wrote: Thu Feb 21, 2019 9:19 pm With which code?
I use the builtin' bludit sidebar code for all sidebar plugins, as descibed in my first post

Code: Select all

<?php Theme::plugins('siteSidebar') ?>
categories works fine, tags throws error.
I have no idea how to approach to fix this bug(?).
I'll try to write my own code, but I just feel it will end up with same problems accessing DB.
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

I do not understand what you are trying to do... Including the sidebar in a page?
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
Jay
Master Bludit
Posts: 133
Joined: Mon Feb 11, 2019 8:41 pm

Edi wrote: Thu Feb 21, 2019 10:27 pm I do not understand what you are trying to do... Including the sidebar in a page?
Basically yes. I'd like to get a sidebar with all bludit's plugin in devtheme.
Otherwise I'd need to wrote my own code to include every plugin I'd like to have :cry:

If you wan't to get an overview of the error, add the <?php Theme::plugins('siteSidebar') ?> code somewhere in devtheme, for example footer.php and check the difference between showing categories and tags on homepage and in one of posts (assuming both categories and tags plugins are enabled).


edit: it is the same problem i had with trying to list all posts under domain/blog/postX urls.
object(Tags) can be accessed only on homepage.
And this explains why categories show up without problem on all pages - they are an array type which can be accessed globally.
The funny part of this situation is that under blogx or mediumish theme everything works fine.
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

Jay wrote: Thu Feb 21, 2019 11:10 pm The funny part of this situation is that under blogx or mediumish theme everything works fine.
The theme DevTheme has some additional functions, which perhaps can cause the issue. The best would be to ask the developer.

Either on GitHub at

https://github.com/blthemes/DevTheme

or in the Bludit chat at

https://gitter.im/bludit/support
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
Jay
Master Bludit
Posts: 133
Joined: Mon Feb 11, 2019 8:41 pm

Edi wrote: Fri Feb 22, 2019 5:56 pm The theme DevTheme has some additional functions, which perhaps can cause the issue. The best would be to ask the developer.
Right when you were writing answer I was contacting with devtheme's developer :lol: (forgot devtheme's is a 3rd party developer's theme)
They'll soon update the theme to meet all new core updates.

But still, after comparing all methods used in theme with default bludit's theme everything seems fine.
Using all bludit's method I needed didn't make any problems.
At least on homepage.
User avatar
Jay
Master Bludit
Posts: 133
Joined: Mon Feb 11, 2019 8:41 pm

Edi wrote: Fri Feb 22, 2019 5:56 pm The theme DevTheme has some additional functions, which perhaps can cause the issue. The best would be to ask the developer.
Something touched me to try one additional thing, as I believed there has to be 1 small catch. I'd never guess that this snippet was causing trouble

Code: Select all

$tags = $page->tags(true);
foreach($tags as $tagKey=>$tagName) 
and changing this to

Code: Select all

foreach($page->tags(true) as $tagKey=>$tagName) 
Solved the problem.
Post Reply