Monday, December 7, 2009

How to create root mapping menu


How to create root mapping menu
"Mapping Menu" is one of the mapping of our web directory which aims to facilitate our clients to explore our website.

Without further ado, in this PHP tutorial I will explain how to manufacture a menu mapping. As usual, to create a program would need a code ... :p





 <?php

$originalpath=$_SERVER['PHP_SELF'];

$urlbase='http://'.$_SERVER['HTTP_HOST'];

$roottitle='Home';

$path=explode('/',$originalpath);

$jml_element=count($path);

echo '<center><table style="border:1pt solid #666666;"><tr><td>';

echo '<a href='.$urlbase.'>'.$roottitle.'</a>';

for($i=1; $i<$jml_element;$i++) {

$urlbase=$urlbase.'/'.$path[$i];

$path[$i]=str_replace('.php', '', $path[$i]);

$path[$i]=ucwords($path[$i]);

echo ' / <a href=' .$urlbase. '>' .$path[$i]. '</a>';

}

echo '</td></tr></table></center>';

?>

And now i will give you some explanation for the script ....



$originalpath=$_SERVER['PHP_SELF'];

$urlbase='http://'.$_SERVER['HTTP_HOST'];

$roottitle='Home';
Here we set the path, url base, and the root title. If you do not understand, read until finished then you will understand his own point of each .. :p



$path=explode('/',$originalpath);
Here we change the path to an array and separating them by a slash mark



$jml_elm=count($path);
This line is used to calculate the total elements in the array that we get last

Finally...the loop

for($i=1; $i<$jml_elm;$i++) {

    $urlbase=$urlbase.'/'.$path[$i];
Menambahkan direktori selanjutnya



    $path[$i]=str_replace('.php', '', $path[$i]);
Menghilangkan ekstensi .php pada menu mapping



    $path[$i]=ucwords($path[$i]);
Changing the first letter to uppercase

}




That's all.......Just another PHP tutorial :D

Related Posts by Categories



0 comments:

Post a Comment

Maybe this is what you looking for

 

Subscribe Now

Followers

IT Skill is not enough... Copyright © 2009 Designed by Bie Blogger Template