Pages - পৃষ্ঠাসমূহ

Selection tab highlight in navigation bar using php

To decorate a webpage we use css.We colorize our websites using css.Css compressed the code and prettify the websites.In css when we select a tab to colorize it needs to every page to mention a class to decoration the link or tabs. But if we can do this using php it can defined every time. Only call the file to decorate the navigation bar and seleted color in every file.
Hide Example Show Example

create a admin database configure file

One examples given that,suupose some urls are given like this

http://taslimblogger.blogspot.com/post.php?cat=create-site-authenciation-or.html
http://taslimblogger.blogspot.com/post.php?cat=hide-example-show-example.html
http://taslimblogger.blogspot.com/post.php?cat=robotstext-tutorial-and-install-in-web.html
http://taslimblogger.blogspot.com/post.php?cat=increase-website-page-rank.html

So for this pages you will define navigation bar in every pages and define a class. But if you can this in a simply way using php, it wiil be better and very very helpful.

The simple codes are

<?php
	
	function curPageURL() {
		 $pageURL = 'http';
		 //if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
		 $pageURL .= "://";
		 if ($_SERVER["SERVER_PORT"] != "80") {
			$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
		 } else {
			$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
		 }
		 return $pageURL;
	}
	$path = pathinfo(curPageURL());	
	$tab_path=$path['filename'];
	
?>
<div class="menu">
	
	<a href="home1.php" class="<?php if($tab_path=="home1") echo "selected";?>">Home1</a>
	<a href="home2.php" class="<?php if($tab_path=="home2") echo "selected";?>">Home2</a>
	<a href="home3.php" class="<?php if($tab_path=="home3") echo "selected";?>">Home3</a>
	<a href="home4.php" class="<?php if($tab_path=="home4") echo "selected";?>">Home4</a>
	<a href="home5.php" class="<?php if($tab_path=="home5") echo "selected";?>">Home5</a>
	<a href="home6.php" class="<?php if($tab_path=="home6") echo "selected";?>" >Home6</a>
</div>

No comments:

Post a Comment