| Who's Online |
There are currently, 4 guest(s) and 0 member(s) that are online. You are an Anonymous user. You can register for free by clicking hereNo Members are currently logged in. |
|
| Announcements |
Display different logo/header, per webpage
Posted by: SMayer on 11/24/2004 12:33 PM
(Read: 2367)
I am making a new site and wanted to have a different logo on each of various webpages.
I found a way to have one logo on the homepage and a different logo on any other page here.
I tried to extend that for my purposes, but couldn't. So I came up with this little hack to Layout.php that allows any webpage to have it's own logo.
Basically, I made a new template variable, , that will be replaced with the URL of the best logo picture available for each page.
Note that this currently only works for webpages (as in, those things created with the PageMaster/"Web Pages" module). It could easily be extended to work for other modules, but I didn't do that.
For simplicity, I use the PAGE_id of the webpage to decide what logo to show. So, PAGE_id 1 (usually the homepage), looks for Header_1.jpg. PAGE_id 2 looks for Header_2.jpg, etc. If there isn't a Header_#.jpg for the current PAGE_id, then Header_Default.jpg is returned.
So, to use this, first make the change (explained below) to your mod/layout/class/Layout.php file. Then, change your template to include an IMG with src=. Finally, put any logos you want in your themes//images/ folder. You'll want, at least, a Header_Default.jpg. If you want a custom logo on a given page, just find out what it's PAGE_id is (it's in the URL when you are looking at the page), and save the custom logo into the above folder as Header_#.jpg (where # is the PAGE_id).
It's not elegant, but it works great for me. (FWIW, the existing mod, that uses JavaScript to determine which of 2 logos to show, was a great mod and would have worked great for me, but I couldn't get JavaScript to correctly default to Header_Default.jpg if Header_#.jpg didn't exist [I found sample code to do basically this, using the Image object's onLoad and onError event handlers, but I couldn't get that to work].)
Ok, here's the actual patch (againt 0.9.3-4):
*** /usr/share/webapps/phpwebsite/0.9.3_p4-r1/htdocs/mod/layout/class/Layout.php Tue Jul 13 13:16:58 2004
--- mod/layout/class/Layout.php Mon Nov 22 14:06:22 2004
***************
*** 364,369 ****
--- 364,383 ----
$THEME["STYLE"] = $this->pickCSS();
+ if ((isset($_REQUEST["PAGE_id"]))&&is_numeric($_REQUEST["PAGE_id"])) {
+ $pageID = $_REQUEST["PAGE_id"];
+ $potentialLogo = $this->theme_address . "images/Header_$pageID.jpg";
+ if (is_file($potentialLogo)) {
+ $THEME["HEADERLOGO"] = $potentialLogo;
+ }
+ else {
+ $THEME["HEADERLOGO"] = $this->theme_address . "images/Header_Default.jpg";
+ }
+ }
+ else {
+ $THEME["HEADERLOGO"] = $this->theme_address . "images/Header_Default.jpg";
+ }
+
if (is_file($this->theme_dir . "theme.tpl")){
return PHPWS_Template::processTemplate($THEME, "layout", $this->theme_dir . "theme.tpl", FALSE);
} else {
(For those not using *nix's 'patch' command, the lines with + are new, and the lines without "+" are just context.... If you can't figure it out, post here and I'll try to be more explicit...)
Updated by: andrewp on 11/24/2004 12:58 PM
Expires: 01/01/2009 12:00 AM
|
| Comments - Please Log In to make a comment |
| The comments are owned by the poster. We are not responsible for its content.
Why hack, when you could customize?
Posted on: 11/30/2004 10:21 AM
By: ykuendig
Why you hack the layout.php? These things could be done in theme.php, without hacking core files.
Yves
Re: Why hack, when you could customize?
Posted on: 12/02/2004 10:35 PM
By: Anonymous
I agree. Could you provide some coding on how this would be done. I have a need for changing header/logo on different pages.
Thanks in advance.
rogs
Re: Why hack, when you could customize?
Posted on: 12/16/2004 05:42 AM
By: tonynl
Here you find an example how to use theme.php to select a style sheet based on the category of the current page. You can change it easily for selecting headers and logos.
Edited By: tonynl On: 12/16/2004 05:43 AM
powerleveling: coolingame.com
Posted on: 11/03/2008 10:42 PM
By: leveln
Horde Leveling Guide
This wow power leveling guide starts at level 21, if you need wow powerleveling guides for any other powerleveling level range (from 1-21 for example) please take a look at this power leveling page.
This wow power level guide is optimized for FAST leveling with a minimum of grinding sessions. wow powerlevel Quests are important, they give rewards and faction and are less boring than pure wow powerleveling grinding, BUT sometimes some quests are really a time waste and we will skip those and replace them by good wow power leveling grinding session when it is necessary.
Some people say that wow power leveln grinding is always faster than questing, this is true in theory when you don't know which wow powerleveln quests to take and which to avoid, and what is the best order to do them. With this fiesta online guide, questing will be very efficient and much better than pure grinding. Follow each fiesta online instruction carefully and you will see for yourself.
The last chaos quest choices and order to do them are optimal so that you run as few as possible while doing the most possible and then turning several last chaos gold quests in at the same time. This lastchaos gold guide will be very useful for both veteran and novice players. I try to keep the amount of last chaos gold information as short as possible. So even the guide itself is optimized for the minimum reading possible, to save time! Let's get started immediately then! Everything described in this lastchaos gold guide can be done solo (besides when I say otherwise). However you can follow this guide while duoing, grouping, it's not a problem, it works too.
wow power leveling
wow powerleveling
powerleveling
power leveling
wow power level
wow powerlevel
powerleveling: coolingame.com
Posted on: 11/03/2008 10:42 PM
By: leveln
Horde Leveling Guide
This wow power leveling guide starts at level 21, if you need wow powerleveling guides for any other powerleveling level range (from 1-21 for example) please take a look at this power leveling page.
This wow power level guide is optimized for FAST leveling with a minimum of grinding sessions. wow powerlevel Quests are important, they give rewards and faction and are less boring than pure wow powerleveling grinding, BUT sometimes some quests are really a time waste and we will skip those and replace them by good wow power leveling grinding session when it is necessary.
Some people say that wow power leveln grinding is always faster than questing, this is true in theory when you don't know which wow powerleveln quests to take and which to avoid, and what is the best order to do them. With this fiesta online guide, questing will be very efficient and much better than pure grinding. Follow each fiesta online instruction carefully and you will see for yourself.
The last chaos quest choices and order to do them are optimal so that you run as few as possible while doing the most possible and then turning several last chaos gold quests in at the same time. This lastchaos gold guide will be very useful for both veteran and novice players. I try to keep the amount of last chaos gold information as short as possible. So even the guide itself is optimized for the minimum reading possible, to save time! Let's get started immediately then! Everything described in this lastchaos gold guide can be done solo (besides when I say otherwise). However you can follow this guide while duoing, grouping, it's not a problem, it works too.
wow power leveling
wow powerleveling
powerleveling
power leveling
wow power level
wow powerlevel
With Flash?
Posted on: 10/18/2005 12:57 AM
By: Anonymous
How did you get this to work with Flash?
Im pretty new so I haven't been able to get it to work with one as Flash and one as a .jpg
Thanks
|
|