|
|
|
|
![]() ![]() |
Dec 3 2005, 09:54 PM
Post
#1
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 535 Joined: 14-February 05 From: Oslo, Norway Member No.: 3,759 |
I'm not that good with PHP, and I tried this code:
CODE if ( $_SERVER['REQUEST_URI'] == ('/') )/*'/' is the domain root*/ { echo('<img src="{I_ONEURL}" border="0" alt="{T_SOMETHING}" />'); } else { echo('<img src="{I_ANOTHERURL}" border="0" alt="{T_SOMETHING}" />'); } However, it doesn't work. So, basically, I want that if the request is at the root (actually mysubdomain.domain.com), it will show {I_ONEURL} in the image src. If the request is not at the root, but for instance at index.php?showpage=22, it will show {I_ANOTHERURL} in the image src. I hope you understand what I want, and can make a new code. And I know I'm not the best PHP programmer |
|
|
|
Dec 4 2005, 06:07 AM
Post
#2
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 873 Joined: 30-July 04 Member No.: 246 |
That should work fine - maybe there's another section of code causing the block you mentioned to not work properly?
I wouldn't recommend such a method for what you're trying to do. In my opinion, it would be better to use something like: CODE if( $_SERVER['PHP_SELF'] == '/index.php' && count($_GET) < 1 ) { // Is the root } else { // Not the root } Or: CODE $url = parse_url($_SERVER['REQUEST_URI']); if( ( $url['path'] == '/' || $url['path'] == '/index.php' ) && !isset($url['query']) ) { // Is the root } else { // Not the root } If that makes sense. That's my two dollars worth, anyway. |
|
|
|
Dec 4 2005, 08:33 AM
Post
#3
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 535 Joined: 14-February 05 From: Oslo, Norway Member No.: 3,759 |
Actually, my code worked.
I was using it on a phpBB board, in the template file. I have installed a modification which should allow me to use PHP codes in the phpBB template file. But obviously, I couldn't use the special phpBB template tags IN the PHP code... Well, I thought I did something wrong. Anyways, thanks for your help |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 13th October 2008 - 10:30 PM |