Welcome to Geeklog, Anonymous Saturday, July 27 2024 @ 02:07 am EDT

Geeklog Forums

Different header for different pages....


rob1

Anonymous
Hi- just playing with this and I REALLY want to switch my site over to Geeklog! (I do have it installed- etc.) But- I've got an issue I need to figure out. The short of it is- I want to create a seperate php page for each of my 'topics'/categories. I want each to have its own header. (i.e., index.php pulls one header; article-news.php pulls a different header; article-reviews.php pulls yet a third header.) How the heck can I do this? OK- here's the long of it! I'm switching over a static site. It ranks well enough in the search engines. If I switched to Geeklog for my whole site, it's going to kill me with the SE's. Besides the fact the spiders don't follow the dynamic urls (or the static ones created by the plug in)- I loose my metatags. Also- I prefer to have a different graphic title at the top of my pages and a bit of text. In short- I need to have each of the pages pull a different header template which is customized for that page. (Links2 does this really nicely!) I know there's already a bit of this done (for example- article.php) - but it pulls the same header as index.php does. (Also- I hacked the hell out of the header.thtml and was pulling in includes and stuff- which actually worked exactly like I wanted it to until I realize all of that hard coded mess was displaying at the top of EVERY page. NOT the effect I was going for!) SO- any hints on where I start looking to change this. I'm still new to PHP, but am fairly good at figuring things out. However- this is a bit beyond me. I need to know: 1. is this possible (I know it's possible!); 2. how hard it would be; 3. what files should I start looking at if I'm going to try to hack this out. (And I know it will require additions to all the existing templates- but that's ok.) Thanks in advance for any info. I REALLY want to use this script- but I really want to cover my butt with the search engines as well.
 Quote

Status: offline

Tony

Site Admin
Admin
Registered: 12/17/01
Posts: 405
Location:Urbandale, Iowa
Well, here is one way you can do it though it lacks a bit of elegance. If you look closely at COM_siteHeader and COM_siteFooter you will notice a section of code that check for the existence of <theme_name>_siteHeader() and <theme_name>_siteFooter() respectively. If those functions exist, it will call those completely overriding the default header/footer logic. So, let's assume your theme is named MyTheme. In /path/to/geeklog/public_html/layout/MyTheme/function.php you would create functions called MyTheme_siteHeader and MyTheme_siteFooter. For the topic-by-topic stuff, be sure to declare $HTTP_GET_VARS as global and then you can do something like: switch($HTTP_GET_VARS['topic']) { case 'topic1': //Load topic1's templates break; case 'topic2': //Load topic2's templates break; . . . case 'topicN': //load topicN's templates } // Now do substitutions . . . // Return resulting HTML return $HTML_output; Make sense?
The reason people blame things on previous generations is that there's only one other choice.
 Quote

Status: offline

Tymz79

Forum User
Junior
Registered: 07/23/03
Posts: 15
Hey Tony, This was a wonderful referance, exactly what I was looking for. I made changes to the function COM_siteFooter to set some variables based on the user's location, since the footer template doesnt process php. I am getting ready to upgrade from 1.3.7 to 1.3.8, and to avoid overwriting my changes in lib-common.php, I copied them to lib-custom.php, following the instructions you gave above. Unfortunately my [theme_name]_siteFooter wasn't getting called as it should have been, and this is why... The code you mentioned in COM_siteFooter to check for [theme_name]_siteFooter existence reads as follows:
Text Formatted Code

    // If the theme implemented this for us then call their version instead.

    $function = $_CONF['layout'] . '_siteFooter';

    if( function_exists( $function ))
    {
        return $function();
    }
 
In the config file, the theme name is set in $_CONF['theme'], not "layout". It needs to be changed to "theme" in the function. Once that is done, it works... almost. It will not display the right block on pages that are supposed to have them. This is because the parameters sent to COM_siteFooter aren't being passed to $function in the return statement. Change it to:
Text Formatted Code
return $function( $rightblock);
This should now work. The same needs to be done to COM_siteHeader if a [theme_name]_siteHeader function is used instead. Tym.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by Tymz79:It needs to be changed to \"theme\" in the function.
That\'s fixed in Geeklog 1.3.8, btw. bye, Dirk
 Quote

Status: offline

Tymz79

Forum User
Junior
Registered: 07/23/03
Posts: 15
Quote by Dirk:
Quote by Tymz79:It needs to be changed to \"theme\" in the function.
That\'s fixed in Geeklog 1.3.8, btw. bye, Dirk
Heh, good to know. I was trying to figure it out so I could upgrade to 1.3.8 without overwriting my changes. Funny how that works out. Thanks Dirk. Tim.
 Quote

Status: offline

DTrumbower

Forum User
Moderator
Registered: 01/08/03
Posts: 507
When it comes search engines, most don\'t use metatags any more. Don\'t know what main search engines you are using, but google searchs dynamic sites, just fine. Now that google has switched is searching routine, sites should be picked up quicker. No more \"google dance\".
 Quote

All times are EDT. The time is now 02:07 am.

  • 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