How To Call A Php File From Another Php File

May 5, 2007

I need to call a "rotate.php" file from my index.php file and I am not sure of the best way to do this, any ideas?

View 6 Replies


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

View 1 Replies

Variable Is Activated When Call It From Index File But Not From Included File?

The code works when I declare $lang like this (at the top of the index file):

index.php (with php variable declaration at the top):

$lang = 'es';
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"


Is $lang really having any value when its declared in the common.php file?

edit: the language change in the file is working is just the class .current not being activated, weird.

View 3 Replies

Call File With A Query String To Select A Record Out Of A XML File?

i want to call my php file with a query string to select a record out of a XML file... im close but cant get the variable i pass to be the record selected..

example... index.php?auction=1

i highlighted in red, where it doesnt pick up the proper row

Code: [Select]<?php
ini_set('display_errors', 1);

View 3 Replies

Call Function Defined In File Include After File

Suppose i have following files

include 'file_A';
include 'file_B';

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.

View 1 Replies

Jquery - Call A Javascript File During File Execution?

I'm dealing with passwords so security is critical. Here's the flow...I want to periodically update a user's screen with data I am fetching. I would use a jquery function and call a smaller php file upon success, but I don't want to pass the user's password in a POST function. I am assuming that if I call a jquery function from within the PHP function periodically, that would eliminate the issue of passing a password using the post function to php. Reason I'm passing a password is that I'm using IMAP and have to use a user's password in order to retrieve emails. Current flow (non secure)1.) Pass username and password using javascript into PHP function using jquery AJAX and POST variable. My assumption is that this is not secure.

View 2 Replies

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?

View 2 Replies

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)....

View 5 Replies

Call A Script File From The Main File?

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?

View 2 Replies

Adding File Within Function Without Having To Call File?

i have got a function below which i am using in a wordpress plugin.

here is the code.

// Base function
function isd_s3player() {
// Plugin Url
$s3url = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__));
echo '<object type="application/x-shockwave-flash" data="'.$s3url.'dewplayer-playlist.swf" width="235" height="200" id="dewplayer" name="dewplayer">
<param name="wmode" value="transparent" />
<param name="wmode" value="transparent" />

ok the problem i am having is i cant passed the database variable to the playlist.php which the dewplayer needs to call within the function.

is their a way to somehow use or set the playlist.php in this function without having to call it seperatly???

Here is my playlist.php

$bucket = get_option("isd-bucket");
$folder = get_option("isd-folder");
//include the S3 class
if (!class_exists('S3'))require_once('s3/S3.php');

ok so as you can see right at the top i am trying to grab two option from the database but it doesnt allow you to do it this way within wordpress.

So i guess what i am asking is their a way to completely skip the playlist.php file and do everything within the function???

View 1 Replies

Include Multiple Functions In A File And Call Them Through Jquery Post Or Jquery.get In A Javascript File?

I want to call various functions made in PHP from my javascript file. Normally using we call a PHP file and and pass various values as post.

function new_user(auth_type, tr_id, user_name, email)
$.post("bookmark.php",{AuthType:auth_type, TR_Id:tr_id, UserName:user_name, UserEmail:email});

If I want to create multiple functions in the PHP file and call them through jquery/ajax how do i do that?

View 4 Replies

JavaScript Call A Function Directly - Separate Php File To Call The Function?

I am doing some basic Ajax stuff (not jquery.. just learning the basics), and I have a general structure set up where html calls a javascript function which sends data to and runs a specific php page.

But what if I just need to run a php function that's already defined in functions.php. Is that possible at all? I'm getting tired of making new php files for every task ;)

View 3 Replies

Call A Php File

i have the code; PHP Code:

if (isset($_POST['submit']))
Call another.php

View 2 Replies

Call An Swf File?

I'm using the zend framework. From within my phtml file, I am trying to call a link to a swf file that is outside of my web directory.The code for this link is:

<?php echo getcwd(); ?>
<object width="550" height="400">
<param name="movie" value="somefilename.swf">
<embed src="/message/get-file/messageId/<?php echo $this->message->id; ?>" width="550" height="400">

View 2 Replies

How To Call Xml To Another File

i have php file that reads the data from three table of mysql in xml now i want to call the xml data on this page into another page.

View 3 Replies

Include A File In An Index File Into Another Files And Those Included File Is Including One File Also

i was trying to include a php file in an index file into another files and those included file is including one file also. But for some reason the database connection file is not included.


I really don't understand why it doesn't work and it's giving a server error 500. The form loads like it should in the index.php but the rest doesn't

View 4 Replies

How To Call Function In Other File?

I have a file password.php, which includes function:
function generate_password()
return $password

How do I call that function from other file - forexample other.php?
like: $pass = generate_password();

(if I copy that function to end of other.php, it works, but I have several
such functions, and I would like to keep them in their own files)

I tried renaming generate_password to password() and calling password() but
it doesn't work.

View 2 Replies

Best Way To Call A Global.php File

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.

View 1 Replies

How To Call Different Methods In One PHP File?

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?

View 7 Replies

Possible To Use Include() To Call Xml File?

Could anyone tell me whether it's possible to call an xml file as an include?

i.e. include("myfile.xml");

The xml file itself contains the xsl declaration. I can't add all elements to the xsl stylesheet as the page I wish to add the xml file to has a number of db driven elements around it.

Obviously this can be done by parsing the xml file, but I'd rather not do that if possible as the contents updated frequently and old data doesn't require archiving.

View 1 Replies

Call A CSS File From The Right Place?

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?

View 2 Replies

Call Function In Other File?

I haven't found anywhere answer for this. I have a file error-status.php, which includes function:

function validateHostName($hostName)
if ((strpbrk($hostName,'`~!@#$^&*()=+.[ ]{}\|;:'",<>/?')==FALSE) && !ctype_digit($hostName) && eregi("^([a-z0-9-]+)$",$hostName) && ereg("^[^-]",$hostName) && ereg("[^-]$",$hostName))
return true;
return false;

How do I call that function from other file - forexample other.php? like:


now how i call function in that in php

View 4 Replies

Call Different Images From One File?

I wrote a little script that allows me to call information from my database. Basicly this.

<td id="seal"><?php
echo "$websiteaddress";

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?

View 2 Replies

Call Function From Another File?

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.


View 8 Replies

Call Css File For Iframe?

I am calling some data from iframe.

<iframe id="pframe" width="'.$game['iframewidth'].'" height="'.($game['iframeheight'] + 20).'" src="'.$path.'" frameborder="0" scrolling="no" align="middle"></iframe>';

i want to call my css for this frame ? How to call css for iframe??

View 8 Replies

Call ASP.NET .dll File From A Script?

Do you know how can I call an ASP.NET .dll file from a PHP script?

View 1 Replies

Copyrights 2005-15, All rights reserved