Saturday, May 19, 2012

Return Home
Contact Me

Soholaunch Path to Install Function

If you need an automated way to figure out the installation path and directory to the Soholaunch install, you can use this function. The function relies on the use of my currentPage function for some string manipulation. It’s especially helpful for coding menus into your template as the file directory can jump when a user goes to the shopping cart.


<?php
function pathToInstall() {
  return str_replace(str_replace(" ","_",currentPage()).".php","",$_SERVER['REQUEST_URI']);
}
?>

Pretty simple, but can be very helpful on getting your links straight.

Click here to download the code (includes a copy of the currentPage function).

Comments

Please post your comments, questions, or suggestions here.

* Denotes a required field.

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Recent Posts: