CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Tips & Solutions

 AUTO INCLUDE CUSTOM FUNCTIONS [PHP]

Print topic Send  topic

Author Message
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
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.