Page 1 of 1
Templates are switching to default in different categories
Posted: Mon Oct 02, 2006 2:29 pm
by Jeff Damn
Hi,
first of all let me start with a big THANK YOU for this fine piece of software
I installed s9y 2 weeks ago and started playing around with it a bit. Especially the possibility to change the theme/template for each (sub-)category is really nice.
My problem is, when i go to the detail-view of an entry (i.e. when i click on the title/headline) the template switches back to the default=top-level template.
I have to admit that I have tested and installed a whole lot of plugins, who might be adding possible configuration-errors of mine.
-event_categorytemplate
-event_assigncategories
-event_contentrewrite
-event_custom_permalink
-event_entrycheck
-event_entryproperties
...
Is there any magic to make s9y keep the template when changing from "category-view" to "entry-view"???
URL --> blog.devjam.de
Example: my "Battlefield"-category
Thanks in advance
Jeff
Re: Templates are switching to default in different categori
Posted: Mon Oct 02, 2006 3:16 pm
by garvinhicking
Hi!
Sadly I think this is due to your change of permalinks; if you had kept the %id% variable in your URL, the plugin could detect which category a single entry is in.
However, I believe we can fix this easily.
Edit your include/functions_permalinks.inc.php file. Search for this function:
Code: Select all
function serendipity_searchPermalink($struct, $url, $default, $type = 'entry') {
global $serendipity;
if (stristr($struct, '%id%') === FALSE) {
$url = preg_replace('@^(' . preg_quote($serendipity['serendipityHTTPPath'], '@') . '(' . preg_quote($serendipity['indexFile'], '@') . ')?\??(url=)?/?)([^&?]+).*@', '\4', $url);
// If no entryid is submitted, we rely on a new DB call to fetch the permalink.
$pq = "SELECT entry_id, data
FROM {$serendipity['dbPrefix']}permalinks
WHERE permalink = '" . serendipity_db_escape_string($url) . "'
AND type = '" . serendipity_db_escape_string($type) . "'
AND entry_id > 0
LIMIT 1";
$permalink = serendipity_db_query($pq, true, 'both', false, false, false, true);
if (is_array($permalink)) {
return $permalink['entry_id'];
}
}
return $default;
}
change this into:
Code: Select all
function serendipity_searchPermalink($struct, $url, $default, $type = 'entry') {
global $serendipity;
if (stristr($struct, '%id%') === FALSE) {
$url = preg_replace('@^(' . preg_quote($serendipity['serendipityHTTPPath'], '@') . '(' . preg_quote($serendipity['indexFile'], '@') . ')?\??(url=)?/?)([^&?]+).*@', '\4', $url);
// If no entryid is submitted, we rely on a new DB call to fetch the permalink.
$pq = "SELECT entry_id, data
FROM {$serendipity['dbPrefix']}permalinks
WHERE permalink = '" . serendipity_db_escape_string($url) . "'
AND type = '" . serendipity_db_escape_string($type) . "'
AND entry_id > 0
LIMIT 1";
$permalink = serendipity_db_query($pq, true, 'both', false, false, false, true);
if (is_array($permalink)) {
$serendipity['GET']['id'] = $permalink['entry_id'];
return $permalink['entry_id'];
}
}
return $default;
}
Note how I set the $serendipity['GET']['id'] variable there.
Tell me if this works out for you!
Best regards,
Garvin
Didn't work
Posted: Mon Oct 02, 2006 4:25 pm
by Jeff Damn
Hi,
Thanks for your quick reply, but it is not working. The blog is now kinda messed up. The posts appear in the wrong categories, some categories are empty (Funny Stuff) even though there are posts listed normally.
And most of all I get no overview or category-view but only the entry-view.
I kept the change for you to see
(blog.devjam.de)
If the problem is dependent on the id in the URL, I can put it back in, if you suggest this.
Thx
Jeff
Posted: Mon Oct 02, 2006 7:46 pm
by Jeff Damn
Hi,
I tried to revert all my changes. I removed the permalink-plugin in the admin panel and I reverted my changes in the configuration. Now I'm using the id again and I rerenamed "categories" (instead of sub)
But still the same problem, in the detailed view the template switches back to default=top-level.
Any other suggestions?
Jeff
Posted: Mon Oct 02, 2006 10:13 pm
by garvinhicking
Hi!
The most easy way to fix this would be if you can give me temporary FTP access to your blog? If you don't want this, we could try some things here on the forums, but it might take some time with all that ping-pong back and forth.
Best regards,
Garvin