Hello,
Serendipity 1.2.1 with PHP 4.4.7 is causing the following problem:
I do have smarty-templating enabled for categories & chose a single category (ID 1) as the starting page. Everything works perfectly until it comes to display an article/entry in single-entry-view:
a) I choose a category (IDs 1-7) and it is displayed as "active" (it is set in {$category_info}).
b) I chose a single article/entry from any category (IDs 1-7) - category ID 1 is "active" (and set in {$category_info}).
If I set things back to show all entries on the starting page, there's a slighlty different behaviour in b):
No category is active (the array in {$category_info} is empty).
How can I change things, so that in single-entry-view the corresponding category is "active" and set in {$category_info}.
I hope someone can help.
Ramoney
categories' templating & category as "homepage"
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: categories' templating & category as "homepage&
Hi!
Actually, you can't really, because single article view is not a category view.
The solution to this is that you would need an event plugin that sets the category ID depending on inside which category the entry is. I believe the plugin "serendipity_event_categorytemplates" already offers to do that with a config option, it should set the requiered $serendipity['GET']['category'] variables which later populate the $category_info array.
Regards,
Garvin
Actually, you can't really, because single article view is not a category view.
The solution to this is that you would need an event plugin that sets the category ID depending on inside which category the entry is. I believe the plugin "serendipity_event_categorytemplates" already offers to do that with a config option, it should set the requiered $serendipity['GET']['category'] variables which later populate the $category_info array.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: categories' templating & category as "homepage&
Hell, yeah, "serendipity_event_categorytemplates" really offers that option, thank you Garvin!garvinhicking wrote:I believe the plugin "serendipity_event_categorytemplates" already offers to do that with a config option, it should set the requiered $serendipity['GET']['category'] variables which later populate the $category_info array.
But things still don't work as expected.
{$category} still showing the 'wrong' category
{$category_info}-array still showing 'wrong' category
The {$entry_category}-array is showing the 'right' info. I will try to somehow combine that with the category-navigation, although at the moment I don't have the slightest clue how to do it.
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: categories' templating & category as "homepage&
Hi!
Hm, I don't realy understand what you mean with "wrong category"?
Is your entry associated with multiple categories, or just one? Only in the case of multiple category assignments you can't really fill $category_info properly...
Regards,
Garvin
Hm, I don't realy understand what you mean with "wrong category"?
Is your entry associated with multiple categories, or just one? Only in the case of multiple category assignments you can't really fill $category_info properly...
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
I'll try and explain:
Every entry belongs to only one category, for example:
"entry 1" belongs to "category 2", but both, {$category} and the
{$category_info}-array show "category 1" when viewing "entry 1" in single entry view.
What I would need when viewing "entry 1" in single entry view is:
{$category} having the value "2" (right) instead of "1" (wrong)
That would result in the category-link for "category 2" having the CSS-class "currentpage" and everything would be fine.
Every entry belongs to only one category, for example:
"entry 1" belongs to "category 2", but both, {$category} and the
{$category_info}-array show "category 1" when viewing "entry 1" in single entry view.
What I would need when viewing "entry 1" in single entry view is:
{$category} having the value "2" (right) instead of "1" (wrong)
That would result in the category-link for "category 2" having the CSS-class "currentpage" and everything would be fine.
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Could it be you're using event plugins like "Start Page category"? This plugin fixates category IDs...
Regards,
Garvin
Could it be you're using event plugins like "Start Page category"? This plugin fixates category IDs...
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Yes, see topic!garvinhicking wrote:Could it be you're using event plugins like "Start Page category"? This plugin fixates category IDs...
But disabling this event-plugin only results in a slightly different result. Now {$category} is set "false" and the {$category_info}-array is empty.
Still the {$entry_category}-array shows the right values: categoryid => "2"
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Yea, the $entry_* stuff is completely on its own.
$category_info is set in index.php and can only get the right values if $serendipity['GET']['category'] was set prior to that. Actually the categorytemplates plugin should properly set this variable when you use it, so I don't really know why it should not do that. One would need to inspect that plugin and see where it sets this variable and make sure it is set properly and BEFORE index.php actually uses it. This might make a difference if the plugin uses the hook 'genpage' but might need to set it on 'frontend_configure' already.
It might be that you'll need to write your own little event plugin that passes through a category ID and sets the smarty variable $category_info properly.
Regards,
Garvin
Yea, the $entry_* stuff is completely on its own.
$category_info is set in index.php and can only get the right values if $serendipity['GET']['category'] was set prior to that. Actually the categorytemplates plugin should properly set this variable when you use it, so I don't really know why it should not do that. One would need to inspect that plugin and see where it sets this variable and make sure it is set properly and BEFORE index.php actually uses it. This might make a difference if the plugin uses the hook 'genpage' but might need to set it on 'frontend_configure' already.
It might be that you'll need to write your own little event plugin that passes through a category ID and sets the smarty variable $category_info properly.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Changing
to
in plugin_categories.tpl seems to do what I wanted to achieve.
Well, it does not work in empty categories, but who needs empty categories...?
Code: Select all
{if $plugin_category.categoryid == $category}currentpage{/if}Code: Select all
{if $plugin_category.categoryid == $entry_category.categoryid}currentpage{/if}Well, it does not work in empty categories, but who needs empty categories...?