Posted on: 02/05/08 06:26am
By: 1000ideen
I think I had had a good idea in this thread:
http://www.geeklog.net/forum/viewtopic.php?forum=8&showtopic=79152[*1]
The idea to use different storytext.thtml files like topic1_storytext.thtml or topic2_storytext.thtml etc. to make the various topics look more differently.
Of course one could change the CSS with a topic or the whole theme but this is not always wanted or sufficient.
What about noting this in the functions.php ? There is already a similar procedure with
$_BLOCK_TEMPLATE['_staticpages_block'] = 'staticpcenterheader.thtml,staticpcenterfooter.thtml';
This feature would be good anyway especially if a site becomes bigger and you have some sort of subdirectories and you definitely want them to look different.
Re: Hack wanted: storytext.thtml
Posted on: 02/05/08 11:54am
By: jmucchiello
If you are running the latest version of my Caching Template Library, you can already do this with changes you put in your lib-custom.php. Not only that, but it would work for any and all templates, not just storytext.thtml.
The latest CTL has a feature where you can hook certain template functions. Set_root in the CTL can look in multiple directories for template files. So you hook set_root such that in addition to looking for templates in $_CONF['path_layout'] it should first look in $_CONF['path_layout']. $topic .'/'
So if layout/themename/topic1/storytext.thtml exists it is used otherwise the template class uses the normal layout/themename/storytext.thtml.
Details of the hack (solving a different problem) can be found in
this post[*2] over on gllabs.org.
Re: Hack wanted: storytext.thtml
Posted on: 02/05/08 12:31pm
By: jmucchiello
I haven't tested this but with the CTL in SVN over at gllabs.org, this code should do what you want:
Text Formatted Code
//Here's the code for lib-custom.php
if (isset($_REQUEST['topic']))
{
$topic = COM_applyFilter($_REQUEST['topic']);
$OldSetRootHook = $TEMPLATE_OPTIONS['hook']['set_root'];
$TEMPLATE_OPTIONS['hook']['set_root'] = 'AddTopicToTemplates';
}
/* @param $root array The list of root directories passed to Template::set_root
* @return array The new list of root directories used by the Template
*/
function AddTopicToTemplates($root)
{
global $topic, $OldSetRootHook;
$A = array();
$cleantopic = strtr($topic, ' \\/', '___'); // remove any path indicators from the topic
foreach ($root as $path) {
if (substr($path, -1) == '/') $A[] = $path . $cleantopic;
else $A[] = $path . '/' . $cleantopic;
$A[] = $path;
}
// maintain the chain of hooks, if necessary
if ($OldSetRootHook) return $OldSetRootHook($A);
return $A;
}
Re: Hack wanted: storytext.thtml
Posted on: 02/05/08 12:49pm
By: 1000ideen
:shock: wooooooooow!
You see, that way one could modify the topics and e.g. make an FAQ or bug report, feature request topic. The bug_report_storytext.thtml could have several more fields than an ordinary storytext.thtml. Actually one doesn`t need many more but something like a status "being worked on by userXY" or so. To keep an overview there could be a static page on the top automatically listing the open or closed stories.
This way Geeklog could have its own mantis or whatever replacement instead of long waiting for anything difficult and external to be installed. I love small practical ideas and this is one.
Another idea would be that in a multiblog Geeklog every blogger could have his own layout, as dicussed in the thread mentioned above.
Great :banana:
Re: Hack wanted: storytext.thtml
Posted on: 02/05/08 12:51pm
By: beewee
There's different and very easy approach, you can use the topic ID 'tid' to use separate classes:
Text Formatted Code
<div class="{tid}">
Re: Hack wanted: storytext.thtml
Posted on: 02/05/08 01:05pm
By: jmucchiello
Reread his post, he said sometime just setting a new CSS class is not enough. You might want some topics to have certain story features in different locations
Re: Hack wanted: storytext.thtml
Posted on: 02/05/08 01:14pm
By: 1000ideen
O.k. that`s for the css only, is it? I did something where I changed the whole CSS in the header according to the topic.
I mentioned this in the other thread: "BTW here is an example of a changing header pic:"
http://www.montessori-schule-wertingen.de/public_html/index.php[*3]
But this is very often not enough and you don`t really want to change the whole theme.
Re: Hack wanted: storytext.thtml
Posted on: 02/05/08 02:03pm
By: jmucchiello
With my hack, you aren't changing the whole theme. Just the files that you need to change are included in the topic directories. If it does not find the needed file in the topic subdirectory it looks in the normal directory for the file.
Or are you replying to beewee?
Re: Hack wanted: storytext.thtml
Posted on: 02/05/08 02:14pm
By: beewee
I guess I missed this part
Of course one could change the CSS with a topic or the whole theme but this is not always wanted or sufficient.
I assumed too soon he ment the old Chameleon hack or the other mentioned CSS hack.
Re: Hack wanted: storytext.thtml
Posted on: 02/05/08 02:19pm
By: beewee
A bit off topic, Markus: what did you do with the hover class in the menubar? Looks different in IE7 and Firefox, and it seems it doesn't look like it's supposed to look.
Re: Hack wanted: storytext.thtml
Posted on: 02/05/08 06:39pm
By: 1000ideen
Thank you both, there was a slight confusion in who is answering whom but anyway it is nice that you are trying to help. :shakehands:
Yes, I`ll give this cache a try, I think it is a good thing. I`d not have thought about using it because I don`t have a high traffic site yet. But it is nice trying out Joe`s inventions.
Actually I just installed the cache. It works fine even with 770 settings. I just don`t get one instruction
I found this line 190 in moderation.php:
$admin_templates->set_var('cc_icon_width', floor(100/ICONS_PER_ROW));
WHERE am I to cut and paste it?
So it will be part of GL core in 2010? Did anybody say there is no roadmap? :speechless:
Re: Hack wanted: storytext.thtml
Posted on: 02/05/08 07:56pm
By: jmucchiello
Quote by: 1000ideenThank you both, there was a slight confusion in who is answering whom but anyway it is nice that you are trying to help. :shakehands:
Yes, I`ll give this cache a try, I think it is a good thing. I`d not have thought about using it because I don`t have a high traffic site yet. But it is nice trying out Joe`s inventions.
Well, the caching function I added is just one of many new features. MediaGallery will require the CTL with the next release because Mark is using those additional features beyond the caching features.
Actually I just installed the cache. It works fine even with 770 settings. I just don`t get one instruction
I found this line 190 in moderation.php:
$admin_templates->set_var('cc_icon_width', floor(100/ICONS_PER_ROW));
WHERE am I to cut and paste it?
It's been too long since I've installed it. The line you clipped is indeed the line that needs to move. Place it shortly after the $admin_templates variable is initialized and before the for () loop shortly after $admin_templates is initialized. I don't remember the line number.
The simpler solution is to use the zip file Mark made which contains modified versions of the 1.4.1 files you need. Additional instructions are
here[*4] .
So it will be part of GL core in 2010? Did anybody say there is no roadmap? :speechless:
Don't be like that. That's my job. It's no fun be reviled. Trust me.
And that's not an official release date. Just my best guess.

Re: Hack wanted: storytext.thtml
Posted on: 02/06/08 07:23am
By: 1000ideen
Re: Hack wanted: storytext.thtml
Posted on: 02/06/08 12:22pm
By: jmucchiello
Quote by: 1000ideenThe code you gave above starting with "//Here's the code for lib-custom.php" is to go into lib-custom.php ?
What am I to do next, how do I "hook set_root"?
That code does the hooking. You have to have the latest template_new.class.php file from SVN on gllabs.org. The download available here is an older version of the library.
Re: Hack wanted: storytext.thtml
Posted on: 02/06/08 12:36pm
By: 1000ideen
Sorry but I am not a programmer I only understand basic html and css. I pasted the above code into the lib-custom.php is this correct?
I downloaded this http://www.gllabs.org/filemgmt/index.php?id=156 correct?
Now, where do I tell the "thing" to use layout/themename/topic1/storytext.thtml

:
Re: Hack wanted: storytext.thtml
Posted on: 02/06/08 02:46pm
By: jmucchiello
You don't need to do anything to hook it. The code you pasted does the hooking. Now you just need the right copy of the template library: It's still in the code repository not in the normal file download:
file[*6] . You might need to do a save as... from your browser.
Re: Hack wanted: storytext.thtml
Posted on: 02/06/08 04:44pm
By: 1000ideen
O.k., I`m beginning to understand. Erm, does your cache remove php from the thtml? I have some php code in my thtml and it seems to be filtered out.

:
Re: Hack wanted: storytext.thtml
Posted on: 02/06/08 06:34pm
By: jmucchiello
No, actually it should run no problem. In fact it should run in any thtml file now. Go to the cache (under data) directory and check that the php is or isn't in the cached file.
Re: Hack wanted: storytext.thtml
Posted on: 02/07/08 06:15am
By: 1000ideen
I`m just about to send you an email with more details. It seems to cut out meta tags.
I cuts away this and this contains some php too:
Text Formatted Code
<meta name="language" content="de">
<meta name="robots" content="index follow">
<meta name="topic" lang="de" content=<?php print $_CONF['meta_tag_topic'];?>>
Re: Hack wanted: storytext.thtml
Posted on: 02/12/08 05:18pm
By: samstone
Wow! Never realized that this Template Caching hack could do so many wonders with Geeklog.
A year ago, I tried to set up an English-Burmese website and was not successful because the Burmese fonts are not yet unicode standard and needed to be embedded; and I just couldn't mix the two with the same storytext.thtml. If I embed the Burmese fonts, the English articles looks ugly, and vise versa. So having separate CSS for the storytext.thtml of each topic would solve that problem.
I can't wait to try out this one.
BTW, each time I introduce myself as a Burmese, some people would ask me where Burma is. Now thanks to Sylvester Stallone for his latest
Rambo[*7] movie so that I don't sound like an alien from another planet.
Thanks,
Sam
Re: Hack wanted: storytext.thtml
Posted on: 02/12/08 07:41pm
By: jmucchiello
Actually the latest version of the library is available for download at
gllabs.org[*8] . I just haven't had the chance to upload the file here.
OTOH, this hack didn't work out quite as well as planned and I haven't had a chance to find out why. But in theory, the library would allow what I'm talking about. Problem is most article URLs don't include the topic in them.... Some day I'll finish the calendar update and get back to this.
Re: Hack wanted: storytext.thtml
Posted on: 02/19/08 07:01pm
By: 1000ideen
Re: Hack wanted: storytext.thtml
Posted on: 02/20/08 11:39am
By: samstone
That great! It should work for me. Never cross my mind to put php above the body tag.
Thanks,
Sam