Add New File And Call Functions From That File Yields Undefined Function Add_action()
I am adding a new file called subtypes.php to my theme /library/includes in order to allow for a dynamic dropdown list. This file uses functions from /library/functions/custom_functions.php. The problem: whenever I call any function from custom_functions.php, I get fatal errors: Call to undefined function add_action(), other times I get undefined function get_option(). It seems to me that the new file doesn't load some default libraries or so
a function defined foo() in file_B, is there any way to use it in file_A by any means? actually, i am working in a application where a range of different functions are defined in modules, i wana use these function across the modules without looking where it defined included before or after the file even.
Call A Method From An Included File NOT From File That Inclued?
This question should be pretty simple. I have a php file in a directory that contains function calls to read files in that directory. I need to be able to access those functions and call them from outside the directory. Is there a way to make php execute those functions relative to the file that they are physically in vs the file they were included into? If not, how would I make sure that I could read those files from different parts of the directory structure?
Flash - Problem To Call An Mp3 File From A Swf File
I have a flash file (accueil.swf) that calls an mp3 file (the_song.mp3) to load a song when the swf animation is launched. Both files are stored on the same root directory (in my PC and onto the web server).
When i click directly on the swf file right on the directory from my PC, the animation works and the song is correctly loaded (we hear the song)....
I want to arrange my codes properly by starting to separate the codes like uploading files, from the index.php, How can i call the upload.php in the index.php? The upload.php is not a function. Is it possible?
I got a site with many sub-directories and I was wondering what is the best way to call a global.php for each page... <? require("global.php");?> doesn't work because pages in the sub-dirs are calling from their own directory.
<? require("/global.php");?> gives me errors...
Anyone got the correct syntax for this? I've never really used global includes on sites with sub-dirs.
I'm a PHP newbie coming from experience with ASP.NET. I want to have a separate PHP file to support each HTML PHP page. This would be the equivalent of an ASP.NET code-behind file but using PHP.
For one page to do a variety of different things I need to call different methods (or functions) in the PHP code file that is dedicated to this purpose. How do you do this? How do you call just one method?
I'm starting a project in PHP, and I want to structure my files properly from the start (unlike my last project, which had almost every file in a single directory). The problem is the following, which I will describe with an example:
Take the following files: index.php, includes/header.php, and css/common.css. index.php 'includes' the header (as will many other php files). The header then calls common.css so that its html elements can be placed properly. common.css will also provide styling for general elements in index.php and other files.Notice that since the header is being included, when the header calls common.css, it does so from the location of the file calling it; in this case, index.php. But if I add, say, modules/friends.php and call the header with it, it will be looking for the CSS file in the wrong spot!
Initially I tried to remedy this by using the actual path for when I call CSS files. However, my local machine and web server have a different layout of directories, and therefore I cannot simply call /var/www/whatever. redirect me to a place where this sort of thing is documented?
All this does is connects to the sql file echoing the users website address thus I type in [URL]... and it returns their name now it also connects to a css file to display an image. What I want to be able to do is display a different image depending on the url such as [URL]... and it displays a red or blue image depending. I thought about trying else elseif but can seem to get it to work. How would I go about doing this?
I'm going back through all my coding and trying to go about things in a different way. The following is my backstage.php file (my main file) for my custom CMS script. Each of the links at at the bottom of this script are functions on my backstagefunctions.php file. I want to know how to I call the function properly when the user selects a link because I don't believe I have it properly.