Welcome to Geeklog, Anonymous Saturday, August 31 2024 @ 11:08 pm EDT
Geeklog Forums
Hack wanted: storytext.thtml
Page navigation
1000ideen
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.
jmucchiello
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 over on gllabs.org.
jmucchiello
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;
}
1000ideen
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:
beewee
Dutch Geeklog sites about camping/hiking:
www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
jmucchiello
1000ideen
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
But this is very often not enough and you don`t really want to change the whole theme.
jmucchiello
Or are you replying to beewee?
beewee
![Oops! Oops!](https://www.geeklog.net/forum/image_set/pixel.gif)
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.
Dutch Geeklog sites about camping/hiking:
www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
beewee
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
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.
Dutch Geeklog sites about camping/hiking:
www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
1000ideen
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:
jmucchiello
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.
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?
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.
So it will be part of GL core in 2010? Did anybody say there is no roadmap? :speechless:
And that's not an official release date. Just my best guess.
![Smile Smile](https://www.geeklog.net/forum/image_set/pixel.gif)
1000ideen
What am I to do next, how do I "hook set_root"?
Concerning the road map: http://www.geeklog.net/forum/viewtopic.php?showtopic=81135
jmucchiello
The 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"?
1000ideen
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
![Confused Confused](https://www.geeklog.net/forum/image_set/pixel.gif)
jmucchiello
jmucchiello
1000ideen
I cuts away this and this contains some php too:
<meta name="robots" content="index follow">
<meta name="topic" lang="de" content=<?php print $_CONF['meta_tag_topic'];?>>
samstone
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 movie so that I don't sound like an alien from another planet.
![Big Grin Big Grin](https://www.geeklog.net/forum/image_set/pixel.gif)
Thanks,
Sam
Page navigation
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content