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'; |
$path=explode('/',$originalpath); |
$jml_elm=count($path); |
Finally...the loop
for($i=1; $i<$jml_elm;$i++) { $urlbase=$urlbase.'/'.$path[$i]; |
$path[$i]=str_replace('.php', '', $path[$i]); |
$path[$i]=ucwords($path[$i]); |
}
That's all.......Just another PHP tutorial :D
0 comments:
Post a Comment