Tag Archives: Php

PHP include ladder to find include path.

April 10, 2007 by aaron
I needed a way to be able to include particular files from files that are themselves included. because the working directory was not necessarily the same, so I needed a way to find what the actual include path should be. The following code snippet finds a specific folder or file and returns the ladder (relative path) to get to it. function find_path($loc,$dir=0){ for($i = 0; $i < 10; $i++){ if($dir){ if(is_dir($ladder.$loc)){ return $ladder; break; } }elseif(is_file($ladder.$loc)){ return $ladder; break; } $ladder .=&#039;../&#039;; } } This code is NOT user-input safe: any checks you do should be hard coded otherwise you might as well just give out your passwords.

Super Category (multi-blog) plugin with no hacks

April 2, 2006 by aaron
This is an old buggy version. Please use the newest. NOTE: I believe the only part that is missing is where it says to follow the instructions in the Up and Running section. In this section it basically said to make a group of links or categories belong to only one site add them to a category with the same name as the url (eg site: http://anthologyoi.dev would have all its links under the anthologyoi.com category).
Read More ⟶

PHP include ladder to find include path.

April 10, 2007 by aaron
I needed a way to be able to include particular files from files that are themselves included. because the working directory was not necessarily the same, so I needed a way to find what the actual include path should be. The following code snippet finds a specific folder or file and returns the ladder (relative path) to get to it. function find_path($loc,$dir=0){ for($i = 0; $i < 10; $i++){ if($dir){ if(is_dir($ladder.$loc)){ return $ladder; break; } }elseif(is_file($ladder.$loc)){ return $ladder; break; } $ladder .=&#039;../&#039;; } } This code is NOT user-input safe: any checks you do should be hard coded otherwise you might as well just give out your passwords.

Super Category (multi-blog) plugin with no hacks

April 2, 2006 by aaron
This is an old buggy version. Please use the newest. NOTE: I believe the only part that is missing is where it says to follow the instructions in the Up and Running section. In this section it basically said to make a group of links or categories belong to only one site add them to a category with the same name as the url (eg site: http://anthologyoi.dev would have all its links under the anthologyoi.com category).
Read More ⟶