Vars To Switch Header Location Wanted If Possible »  Show posts from    to     

Icy Phoenix


Old Support Topics - Vars To Switch Header Location Wanted If Possible



Lopalong [ Wed 01 Apr, 2009 00:05 ]
Post subject: Vars To Switch Header Location Wanted If Possible
MG,

Are there any anchors / vars available to switch the script / markup that could be used in E.g. overall_header.tpl to modify the header.

I.E. :

<!-- IF LOCATION_SEARCH_PHP -->

Blah blah Blah Search-Header Page will change.

<!-- ELSE -->

<!-- IF LOCATION_ALBUM_PHP -->

More blah - Album Header changes?

<!-- ENDIF -->

Would be useful


Mighty Gorgon [ Wed 01 Apr, 2009 10:46 ]
Post subject: Re: Vars To Switch Header Location Wanted If Possible
You can use this code in your overall_header to get the page name and do whatever you want with that:

Code: [Hide] [Select]
<?php echo(basename($_SERVER['SCRIPT_NAME'])); ?>


You can create a condition like this:
Code: [Hide] [Select]
<?php
if (basename($_SERVER['SCRIPT_NAME'], '.' . PHP_EXT) == 'album')
{
?>
We are in album baby!
<?php
}
?>


Lopalong [ Wed 01 Apr, 2009 14:19 ]
Post subject: Re: Vars To Switch Header Location Wanted If Possible
Thanks Luca,

I'll have a stumble through it tomorrow.

But so that we are not confused about the small thing I want to do, I'm trying to use IP only as a forum without all of the CMS attributes and overhead.

Just simple stuff that would appeal to lot of people who only want a simple "Forum" though all of the other options would still be there.

And all I really want to do is to have the simplest way to change these banners, and possibly any other "location" script without having to add or modify anything. So maybe it's something that could be added as default vars to IP.

Here are two examples of why I would like to change the banners to something that reflects where one is.

http://www.lopalong.com/forum/crosswords_index.php
http://www.lopalong.com/forum/smilies_index.php

Update:

Thanks again, because it works a treat.

Only I found it didn't need
Code: [Hide] [Select]
<?php echo(basename($_SERVER['SCRIPT_NAME'])); ?>
and I assume that has already been echoed previously.

The other thing is, it's more functional with "else" arguments, because with "else" one can not only swap the banners, but the logo's too.

I also don't know if there's any value in writing an example doc for this, because of the variations to different headers, and different arguments for every <?php anchor and .css markup.

And I've spent hours hunting the web for anything on how to add "?mode=page1" etc. Found a lot of stuff - Tried a lot of stuff - Nothing worked! - But then again, no-one else uses PHP_EXT constants either!


So is it possible to add ?mode= too?


Mighty Gorgon [ Thu 02 Apr, 2009 13:09 ]
Post subject: Re: [SOLVED] Vars To Switch Header Location Wanted If Possible
Of course it is possible.

You just need to play with globals php vars and some "cool" PHP functions:

http://it.php.net/manual/en/reserved.variables.server.php
http://it.php.net/manual/en/reserved.variables.environment.php
http://it.php.net/manual/en/function.getenv.php
http://it.php.net/manual/en/function.pathinfo.php
http://it.php.net/manual/en/function.parse-url.php


For example this var:
Code: [Hide] [Select]
$_SERVER['QUERY_STRING']


contains only the QUERY (the part after the question mark in URL).


I hope this helps.



Lopalong [ Sun 05 Apr, 2009 00:06 ]
Post subject: Re: [SOLVED] Vars To Switch Header Location Wanted If Possible
Grazzie once more!

Stupid me thought one query would be enough and then add the other bits to the exiting query. Apparently not so.

I've also added this to the back-burner for now while I concentrate on something else, but sure as hell I WILL be using mode=options, because this my friend is far better than the "Random" javascript or .php changers.





Powered by Icy Phoenix