|
DigiOz Guestbook Version 1.6
© 2003 DigiOz Multimedia.
/* -------------------------------------------------------------- PHP Trailing Solution -------------------------------------------------------------- Code developed by: Tahir Ata Barry (Also know as phpMax among the PHP folks). Email: tabarry@email.com or tabarry@sulata.com.pk Company: Sulata iSoft, Lahore, Pakistan Web Site: http://www.sulata.com.pk Development Date: October 6, 2001 Code available at: http://www.sulata.com.pk/trail Server requirement: A web server supporting PHP scripting language. Browser Requirement: Any browser that supports cookies (nowadays all of them do). Instructions: 1. This code has been developed to provide a generic trailing solution. 2. Just add this code to every page that requires to be added it trail. 3. The first defined variable is $title, which must be different for every page is the trail. 4. This title will be displayed as hyperlink text in the trail. 5. If you do not want to copy and paste this all file in every trail page, just remove the $title from this file and define it at the top of every php file to be included in trail. 6. In such a case, the $title must be defined before the include file. 7. This code uses cookies to store trail, so browsers must be enabled to store cookies. 8. You can also control font face and font size from this page by defining the $font_name and $font_size variable. 9. $path is a varible which gets the path of the current file. It uses getenv("SCRIPT_NAME") environment variable to get the path of the file. If this is not supported by you server, then you can also use getenv("PATH_INFO") environment variable. The best way is to check it with phpinfo() function. 10. After you have set the variable on this page, in your page where you want to show the trial, just add a php variable like this: or -------------------------------------------------------------- */ // The $title is the hyperlink test of a page. This must be different for every page in the trail. // $title = "Home Page"; $path = getenv("SCRIPT_NAME"); $path = "$title"; // If you want to control font face and size from PHP, set the font name and size as per your requirement. $font_name = "verdana"; $font_size = "2"; // Code begins here.... $old_value = $HTTP_COOKIE_VARS["my_trail"]; if (strstr($old_value,$path)) { $new_value = $old_value; setcookie("my_trail",$new_value,time()+14400,"/","",0); } else { if($old_value!=""){ $new_value = "$old_value > $path"; setcookie("my_trail",$new_value,time()+14400,"/","",0); }else{ $new_value = "$path"; setcookie("my_trail",$new_value,time()+14400,"/","",0); } } $trail = "$new_value"; $splitter = explode($path,$trail); // Use the option one from below if you want php to set font properties or the option to to define it your self. Just un-comment the option that you do not need. //$trail = "$splitter[0] $title"; $trail = "$splitter[0] $title"; ?>