From an index.tpl file, I want to get the path to a category's entries (ie, http://www.mysite.com/categories/2-examplecategory). I already know the category number (ie 2). And it probably has to work regardless of URL rewriting. Is this possible?
I suppose it would be the equivalent of {$entry_category.category_link} in entries.tpl, but this is from index.tpl.
Ideas???
Category ID known - how to retrieve path?
-
Don Chambers
- Regular
- Posts: 3657
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact:
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Category ID known - how to retrieve path?
Hi!
I guess you'd need a custom smarty function to wrap around the s9y api "serendipity_categoryURL()" function call to put into your templates' config.inc.php file.
Or you could link to index.php?serendipity[category]=2
Regards,
Garvin
I guess you'd need a custom smarty function to wrap around the s9y api "serendipity_categoryURL()" function call to put into your templates' config.inc.php file.
Or you could link to index.php?serendipity[category]=2
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/
-
Don Chambers
- Regular
- Posts: 3657
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact:
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
The documentation to that function can be found inside include/functions_permalinks.inc.php.
A sample code in the config.inc.php could be:
then you can use this inside your .tpl files:
HTH
Garvin
The documentation to that function can be found inside include/functions_permalinks.inc.php.
A sample code in the config.inc.php could be:
Code: Select all
function smarty_categoryURL($params, &$smarty) {
$data = serendipity_fetchCategoryInfo($params['id']);
return serendipity_categoryURL($data);
}
$serendipity['smarty']->register_function('smarty_categoryURL', 'smarty_categoryURL');
Code: Select all
<a href="{smarty_categoryURL id=7}">Category #7</a>
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/
-
Don Chambers
- Regular
- Posts: 3657
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact: