PhP Functions and whatnot
Posted: Thu May 01, 2003 1:48 pm
Okay i have this one problem that will make the difference between 200 lines of code and 50... just so say...
okay, i have 2 files. one is called index.php and another one functions.php. When i load a website index.php is read (DUH) and require_once('filepath/functions.php'); is used.
Now in functions.php there is one function, that "attempts" to open 'read' a file and store it into an array, however, the code that opens the file cannot be in the function.php and only when i move that file() command to the index.php will my website work.
To better explain myself... i am making a template function, that will read a file with some html and some tags, my index.php calls the function and replaces the tags with something. however, to make it work, i must open the file in index.php and then call the function. Which sux when you have 5 templates to call...
I have exactly the same problem while trying to make a dunction called DB_connect, if i put it into a function that is in the functions.php and call it from the index.php, it would not run...
Any help would be killer!!
okay, i have 2 files. one is called index.php and another one functions.php. When i load a website index.php is read (DUH) and require_once('filepath/functions.php'); is used.
Now in functions.php there is one function, that "attempts" to open 'read' a file and store it into an array, however, the code that opens the file cannot be in the function.php and only when i move that file() command to the index.php will my website work.
To better explain myself... i am making a template function, that will read a file with some html and some tags, my index.php calls the function and replaces the tags with something. however, to make it work, i must open the file in index.php and then call the function. Which sux when you have 5 templates to call...
I have exactly the same problem while trying to make a dunction called DB_connect, if i put it into a function that is in the functions.php and call it from the index.php, it would not run...
Any help would be killer!!