| | |
$_server['script_name']
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
ok did u change index.php to other file names. u didn't say which one was working so i choose this. it will work on all files in bobo folder.
but i will also say that any folder combination will set it off also e.g.
folder/bobo/newfolder/
bobo/folder/newfolder/
folder/bobo/bobo/
i don't know how you got it setup but you could think about a include config style file
wat does $style_home do?
but i will also say that any folder combination will set it off also e.g.
folder/bobo/newfolder/
bobo/folder/newfolder/
folder/bobo/bobo/
PHP Syntax (Toggle Plain Text)
$bobo = strrpos($_SERVER['SCRIPT_FILENAME'], "/bobo/"); if ($bobo) { $style_home = 'style="background-color: #6C674F"'; }
i don't know how you got it setup but you could think about a include config style file
wat does $style_home do?
•
•
Join Date: May 2008
Posts: 31
Reputation:
Solved Threads: 5
I'm actually surprised this works at all anywhere because the result will look like:
when printed to the page. You need a space before style=
so you end up with:
If the browser parses attributes correctly it won't see the style at all as it is.
You can almost always sanity check whether it's a php problem or html by echoing "Made it to here" or something within the conditional logic:
if it prints the test and the script exits, php is fine.
-r
PHP Syntax (Toggle Plain Text)
<li class="linkLevel01"><a href="index.php" class="homy"style="background-color: #6C674F">Home</a></li>
so you end up with:
PHP Syntax (Toggle Plain Text)
<li class="linkLevel01"> -------------------------------| |----------- <a href="index.php" class="homy" style="background-color:#6C674F">Home</a> </li>
If the browser parses attributes correctly it won't see the style at all as it is.
You can almost always sanity check whether it's a php problem or html by echoing "Made it to here" or something within the conditional logic:
PHP Syntax (Toggle Plain Text)
# if($_SERVER['SCRIPT_NAME'] == 'index.php') # { # //sanity check echo "Made it to here";exit; $style_home = 'style="background-color: #6C674F"'; # }
-r
•
•
Join Date: Apr 2008
Posts: 9
Reputation:
Solved Threads: 0
Hallo, thanks again. The $style_home gives the active link another color, to specify the user which page he is viewing. This is part of the code:
php Syntax (Toggle Plain Text)
<!-- Navigation item --> <?php $bobo = strrpos($_SERVER['SCRIPT_FILENAME'], "/bobo/index.php"); if ($bobo) { $style_home = 'style="background-color: #6C674F"'; } ?> <ul> <li class="linkLevel01"> <a href="index.php" class="homy"<?php echo $style_home ?>>Home</a> </li> </li> <li class="linkLevel01"> <a href="kamine.php?page=1" class="homy">Kamine</a> </li> <!-- Navigation item --> <li class="linkLevel01"> <a href="#" class="homy">Accessoires<!--[if IE 7]><!--></a> <!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul class="dropdown"> <div class="dropdownMob"> <li><a href="kaminkoerbe.php"> <h6 class="ontok">Kaminkörbe</h6></a></li> <li><a href="kamineinsaetze.php"> <h6 class="ontok">Kamineinsätze</h6></a></li> <li><a href="kaminvorsaetze.php"> <h6 class="ontok">Kaminvorsätze</h6></a></li> </div> </ul><!--[if lte IE 6]></td></tr></table></a><![endif]--> </li>
Last edited by peter_budo; May 16th, 2008 at 6:58 pm. Reason: Keep It Organized - please use [code] tags
•
•
Join Date: May 2008
Posts: 31
Reputation:
Solved Threads: 5
there's still no space between the attributes.
try
you need a space in front of style=
try
PHP Syntax (Toggle Plain Text)
$bobo = strrpos($_SERVER['SCRIPT_FILENAME'], "/bobo/index.php"); if ($bobo) { $style_home = ' style="background-color: #6C674F"';
you need a space in front of style=
•
•
Join Date: Apr 2008
Posts: 9
Reputation:
Solved Threads: 0
It works fine on index.php. But when trying it on kamin.php, the style will appear on both links. Bobo is the folder on the sever and in this folder is all my php files.
php Syntax (Toggle Plain Text)
<?php $bobo = strrpos($_SERVER['SCRIPT_FILENAME'], "/bobo/index.php"); if ($bobo) { $style_home = 'style= "background-color: #6C674F"'; } $bobo = strrpos($_SERVER['SCRIPT_FILENAME'], "/bobo/kanim.php"); if ($bobo) { $style_home = 'style= "background-color: #6C674F"'; } ?> <ul> <li class="linkLevel01"><a href="index.php" class="homy"<?php echo $style_home ?>>Home</a></li> </li> <li class="linkLevel01"><a href="kamine.php?page=1" class="homy"<?php echo $style_home ?>>Kamine</a></li>
Last edited by peter_budo; May 16th, 2008 at 6:59 pm. Reason: Keep It Organized - please use [code] tags
it is because u have $style_home on all links therefore when $style_home is active for one link it will do it for all links. do $style_home1 $style_home2 or something
i tried no space thing and it works. i'm guessing due to " " closing var before it.
•
•
•
•
there's still no space between the attributes.
Last edited by amigura; May 15th, 2008 at 6:03 pm.
•
•
Join Date: Apr 2008
Posts: 9
Reputation:
Solved Threads: 0
When I code it this way, the styling will display on both links at thesame time. And I want it one at a time. That is, when on index.php, show style and when kamin.php, show style.
php Syntax (Toggle Plain Text)
<!-- Navigation item --> <?php $bobo = strrpos($_SERVER['SCRIPT_FILENAME'], "/bobo/index.php"); if ($bobo) { $style_home = ' style="background-color: #6C674F"'; } ?> <?php $bobo = strrpos($_SERVER['SCRIPT_FILENAME'], "/bobo/kamine.php?page=1"); if ($bobo) { $style_kamine = ' style="background-color: #6C674F"'; } ?> <ul> <li class="linkLevel01"> <a href="index.php" class="homy"<?php echo $style_home?> exit;>Home</a> </li> </li> <li class="linkLevel01"> <a href="kamine.php?page=1" class="homy"<?php echo $style_kamine?>>Kamine</a> </li>
Last edited by peter_budo; May 16th, 2008 at 7:01 pm. Reason: Keep It Organized - please use [code] tags
•
•
Join Date: Apr 2008
Posts: 9
Reputation:
Solved Threads: 0
When I code it this way, the styling will display on both links at thesame time. And I want it one at a time. That is, when on index.php, show style and when kamin.php, show style.
php Syntax (Toggle Plain Text)
<!-- Navigation item --> <?php $bobo = strrpos($_SERVER['SCRIPT_FILENAME'], "/bobo/index.php"); if ($bobo) { $style_home = ' style="background-color: #6C674F"'; } ?> <?php $bobo = strrpos($_SERVER['SCRIPT_FILENAME'], "/bobo/kamine.php?page=1"); if ($bobo) { $style_kamine = ' style="background-color: #6C674F"'; } ?> <ul> <li class="linkLevel01"><a href="index.php" class="homy"<?php echo $style_home?>>Home</a></li> </li> <li class="linkLevel01"><a href="kamine.php?page=1" class="homy"<?php echo $style_kamine?>>Kamine</a></li>
Last edited by peter_budo; May 16th, 2008 at 7:01 pm. Reason: Keep It Organized - please use [code] tags
the original code works ok apart from missing ;
u should use code tags [CODE ] code here [/CODE ]
u should use code tags [CODE ] code here [/CODE ]
PHP Syntax (Toggle Plain Text)
<!-- Navigation item --> <?php if (strrpos($_SERVER['SCRIPT_FILENAME'], "/bobo/index.php")) { $style_home = 'style="background-color: #6C674F"'; } elseif (strrpos($_SERVER['SCRIPT_FILENAME'], "/bobo/kamine.php")) { $style_kamine = 'style="background-color: #6C674F"'; } ?> <ul> <li class="linkLevel01"><a href="index.php" class="homy" <?php echo $style_home; ?>>Home</a></li> <li class="linkLevel01"><a href="kamine.php?page=1" class="homy" <?php echo $style_kamine; ?>>Kamine</a></li> </ul>
![]() |
Similar Threads
- Help beta testing new CMS (PHP)
- url splitting (PHP)
- code output not correct (PHP)
- Making a static but yet a dynamic navigation (PHP)
- Need HELP in pagination (PHP) (PHP)
- pagination of mysql query results (PHP)
- Font Size Problem (PHP)
- Display URL (PHP)
- Error getting forms to send information (PHP)
Other Threads in the PHP Forum
- Previous Thread: Remove Non Printing Characters From Text
- Next Thread: help with code
| Thread Tools | Search this Thread |
ajax apache api array beginner binary broken button cakephp checkbox class cms code countingeverycharactersfromastring crack cron curl database date display dynamic echo email error fcc file files folder form forms freelancing function functions google href htaccess html image include incode insert integration ip java javascript joomla limit link login loop mail match menu method mlm mod_rewrite multiple mysql oop pageing pagerank paypal pdf php problem query radio random recursion recursiveloop regex remote script search server sessions sms soap source space sql strip_tags subversion support! syntax system table template tutorial update upload url validator variable video virus web window.onbeforeunload=closeme; xml youtube





