feha
Posts: 712
|
Posted: 09/20/2005, 2:02 PM |
|
This solution has been used on all my projects
[have published before]
At the end of your Common.php file add following code:
// START AUTO INCLUDE FOR CUSTOM FUNCTIONS
// BY WWW.VISION.TO
if(!defined("Func_Suffix"))
{define("Func_Suffix", "_func.php");}
$custom_functions="";
if(file_exists(RelativePath . "/Functions/index.php"))
{
$custom_functions="";
$custom_functions = opendir(RelativePath . "/Functions/");
while (($function_include = readdir($custom_functions))!=false) {
if ($function_include != '.' && $function_include != '..') {
if (eregi(Func_Suffix,$function_include))
{
include(RelativePath . "/Functions/$function_include");
}
}
}
closedir($custom_functions);
$custom_functions="";
}
// END AUTO INCLUDE FOR CUSTOM FUNCTIONS
Create in project root dir the folder named
"Functions"
create in this folder empty file:
index.php
function sample:
<?php
function my_test()
{
return="TEST OK";
}
?>
create a file named:
custom_func.php
and paste the code above.
this function will be autoincluded and accessible to call from any page in your CSS project ...
You can put as many function files as you want in your folder named "Functions" they need to end
_func.php
in order to be autoincluded
one file can have many custom functions ...
Hope You like it
_________________
Regards
feha
www.vision.to
feedpixel.com |