Here's a folder structure I have:
In functions.php I have a function called getUser. I want to use that function in ajax_functions.php, but when I call it, I get the "Function does not exist" message. I used include to include the functions.php file into ajax_functions.php but that gave errors saying it couldn't open such folders as libs/Smarty.class.php.
How can I call getUser in the ajax_functions.php when the function is wrote in functions.php I hope I don't have to have the function in both pages, I was hoping to just have it in the one.
Hope you understand... thanks for the help if any.
It all depends on the project structure. Where are you including functions.php and ajax_functions.php from? For example, consider your full setup was:
If we wanted to include both files inside index.php, we could simply use the following statements:
In ucpanel.php I include the functions.php file. I use the request method in PrototypeJS to call AJAX, and it grabs the ajax_functions.php from the form action.
Ah right, I see. In that situation you will need to include functions.php inside the ajax_functions.php file. Don't specify any path, just the filename, such as:
The problem I get when doing that is, in functions.php, I have another include:
Meh, I just gave in and copy/pasted the function into the ajax_functions.php file as well as in the functions.php file.
|All times are GMT. The time now is 01:24 AM.|
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0