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?

ADVERTISEMENT

Add New File And Call Functions From That File Yields Undefined Function Add_action()

Aug 11, 2010

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 View Related

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

Feb 21, 2010

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

<?php
$lang = 'es';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>

[Code]....

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 View Related

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

Feb 4, 2011

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); 
error_reporting(E_ALL);[code]....

View 3 Replies View Related

Call Function Defined In File Include After File

Apr 18, 2011

Suppose i have following files

<?php
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 View Related

Jquery - Call A Javascript File During File Execution?

Feb 7, 2011

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 View Related

Call A Method From An Included File NOT From File That Inclued?

Oct 11, 2009

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 View Related

Flash - Problem To Call An Mp3 File From A Swf File

Jan 16, 2008

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 View Related

Call A Script File From The Main File?

Jan 14, 2011

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 View Related

Adding File Within Function Without Having To Call File?

Feb 21, 2011

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" />
code....

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

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

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 View Related

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

Jun 22, 2010

I want to call various functions made in PHP from my javascript file. Normally using Jquery.post 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 View Related

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

Dec 6, 2010

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 View Related

Call A Php File

Jun 17, 2005

i have the code; PHP Code:

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

View 2 Replies View Related

Call An Swf File?

Oct 24, 2010

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">
</embed>
[code]....

View 2 Replies View Related

How To Call Xml To Another File

Nov 10, 2010

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 View Related

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

Jan 20, 2011

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.

[Code]....

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 View Related

How To Call Function In Other File?

Jul 17, 2005

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 View Related

Best Way To Call A Global.php File

Sep 16, 2005

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 View Related

How To Call Different Methods In One PHP File?

Jul 17, 2005

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 View Related

Possible To Use Include() To Call Xml File?

Dec 10, 2005

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 View Related

Call A CSS File From The Right Place?

Apr 13, 2011

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 View Related

Call Function In Other File?

Apr 27, 2011

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;
}
else
{
return false;
}
}
....

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

require_once('error-status.php');

now how i call function in that in php

View 4 Replies View Related

Call Different Images From One File?

Nov 6, 2009

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

<table>
<tr>
<td id="seal"><?php
include("sql.php");
echo "$websiteaddress";
?></td></tr>
</table>

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 View Related

Call Function From Another File?

Oct 27, 2009

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.

[code]...

View 8 Replies View Related

Call Css File For Iframe?

Mar 2, 2009

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 View Related

Call ASP.NET .dll File From A Script?

Nov 22, 2008

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

View 1 Replies View Related

Call A .ini File In A Class?

Jan 31, 2011

I'm building a Postgresql "driver" for a project. I have used an ".ini" file to store the database details.Now I'm a little bit confused on how to call the ".ini" file.I have this code. But give me an error.

<?php
class Postgresql {
[code].....

View 1 Replies View Related

Call Txt File Into Lightbox?

Sep 28, 2010

I had a function working perfectly on an existing script where by when the user clicks on the image, the image pops up in the lightbox style and underneath the image it would display information about that photo from a text file. However, as i've now got a script that read multiple directories instead of just one directly, I can't get the script to work anymore. Here is what I had originally to read the file:

Code: [Select]$text = "gallery/gallery.txt";
$fh=fopen($text, "r");
while(!feof($fh))
{
$temp = explode("|", $line);
$title[$temp[0]] = $temp[1];
$description[$temp[0]] = $temp[2];
$photographer[$temp[0]] = $temp[3];

[Code]...

View 1 Replies View Related

Call Function From File?

Sep 11, 2010

I have two functions in myFunctions.php

1 is myName() and second one is yourName()

function myName()
{
echo "my name is this.";
}
function yourName()
{
echo "your name is that.";
}

and I have two submit button. One is my and another is you. When user click on my button. then myName() function is called and when user click on you then yourName() function is called.

View 1 Replies View Related

Call A Function That Is Stored In Another File

Oct 7, 2003

I am trying to call a function that is stored in another file. When I am getting a fatal error that says call to undefined function. Code:

View 4 Replies View Related

Call Dll File In Client System?

Aug 28, 2010

I want to call the dll that is available in client machine(For example:C:Program FilesApplicationnameexample.dll).I am using windows environment.So No issues with using COM.But I dont know how to create a object for the client's machine dll?

View 2 Replies View Related

Ajax Call File Or Files?

Jun 11, 2010

I have a module setup that uses ajax calls, should I have one file for all my ajax calls or should all the calls have their own file? Example of what I mean:

index.php ------ With the ajax calls

Should I have one file such as 'ajax.php' that has functions for update, delete, and edit. Or should I have update.php, delete.php, and edit.php?

View 5 Replies View Related

Call A File In Webroot From A Controller?

Jun 28, 2011

I have a php file in webroot.which returns an array of filenames.So I want to call this php file from a controller.can u give me an ideaa how ll I do this...??the content of this php file is given below:

<?php
//if($_SERVER['REMOTE_ADDR']=='10.1.31.77'){debugbreak();}
include ("../vendors/xmlrpc.inc");
?>
<html>

[Code]....

So i just want call this page from a controller so how ll i call this page,and set this this $output array in the controller.

View 1 Replies View Related

Call External Javascript File ?

May 3, 2011

I am learning how to call external javascript files in my PHP code. I got some codes from the internet and tried it but its not working. Can somebody pls give me some advice or explain to me this. I am not a programmer but I am studying how to program and just started learning that's why I have difficulty understanding some concepts.I have here the codes, PHP File and JS file. They are in the same folder.

Here are the codes:

index.php
<html>
<head>[code]....

View 4 Replies View Related

Build A Custom Call API File?

Oct 22, 2009

I'm trying to build a custom call API file so it makes it harder for hackers to attack my application. My question is do I have to put every custom variable like $test = array(); through my API? How exactly should I go around to building a custom API?

View 2 Replies View Related

Wordpress - Want To Call It From A Javascript File?

Feb 17, 2011

This is a file location not a script or functionality problem. I made a Wordpress theme and wanted to call a popup contact form via jQuery, if the form is validated, my js file will call a php file to send the email. Here is the file/folder structure:

wp_theme_root
|
js/popup_form.js
|
mailer.php

I just want to know where should I place the mailer.php form, as I tried put it the same directory with the js file or in theme root or in the wordpress directory but all are not successful.

View 3 Replies View Related

Call Onload From Separate File?

Jul 8, 2011

I have a file header.php which is being used by all other files. This file has body onload function. But this function is only being used by one other file called test.php. How can i call this function from test.php by using jQuery or php.

<body onLoad="setCountDown();">

View 2 Replies View Related

Call Included File Functions?

Aug 18, 2010

lets say i make a file Services.php

<?php
$myGlobalVar='ranSTR';
function serv1($num)
{
//some processing...
return $num;
}
function serv2($num)

[Code]...

and i include it in some other file lets say myFile.php by include "Services.php";

OR

require "Services.php";

How can i call its functions in myFile.php

View 3 Replies View Related

Attach A File With A CURL XML Call?

Jul 15, 2009

I'm using the Amazon AIMS API to upload a an inventory file and I'm having an issue with the cURL call to upload the file.

This is what I have so far of the cURL call:

// $FILENAME is filename of the CSV file being uploaded:
$inventory = fopen($FILENAME, 'r') or die("Can't open file!");
echo $inventory;
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

[Code].....

I've try putting $inventory into the CURLOPT_POSTFIELDS and not having an INFILE, but I get the same error.

On the XML response, I'm getting "NO_FILE_ATTACHED" so the obvious issue is getting the file to be attached to the XML call.

I also tried uploading as the first responder said using the Example #2 on the curl_setopt page on php.net.

For that, I used the following code:

$data = array('@/tmp/amazon_export.csv');
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($ch);
curl_close($ch);

I got the same NO_FILE_ATTACHED response back.

View 3 Replies View Related

Call Controller Action From Ctp File?

Nov 1, 2010

I want to call an action of controller file from a .ctp file in cakephp. I have an action in controller. users_controller.php

<?php
class UsersController extends AppController {
function get_category() {
....
}
}
?>

I want to call it from /question/index.ctp file.

View 3 Replies View Related

Call A File Name Or Caption Into Paypal

Nov 30, 2007

Im using Plogger.org and the system uses PHP  In Plogger's forum several have asked for a Paypal shopping cart but with little discussion. My question is how do I call the file name or caption and have it sent to Paypal as a purchase. Code:

View 2 Replies View Related

File Call The 10 Scripts, With A 30 Second Interval Between Them.

May 7, 2007

I have a script to backup a particular database. If I create another instance of this script I can backup a different database, and so on. If I have (say) 10 databases to backup, I would have to create 10 instances of this script. That's not the problem.

The problem is that rather than create 10 cron jobs, I would like to have one file call the 10 scripts, with a 30 second interval between them. Then I would only need one cron job. Is there a way to have one script call other scripts? I have tried variations on the code below, but only the first script gets called. Code:

View 5 Replies View Related

'php-include' - Call This File Every 30 Seconds?

Oct 26, 2007

I have a .php file that I call through an include in the main page.  It is a server-side file that pulls in a random image from the photo galleries.

What I'd like to do is simply set it up so that it calls that include file once every so often, sort of as an auto-refresh.

I've spent the last week searching the internet, but I can't seem to find a solution to this problem.  But, then again, my knowledge and understanding of PHP is limited.  I have tried different solutions, but now I realize the best one needs to be simply setting up a timer that as it counts-down to zero it runs the 'include()' function.

View 10 Replies View Related

Call Multiple File From According To Menu?

Jan 20, 2010

I m calling one index.php file from this html.. but now i want to know that how can i call multiple file from according to menu.. I mean to say that .suppose user select 'addnewcustomer' so instead of index.php , i can call addnewcustomer.php. IS IT POSSIBLE? code below

[code]...

View 1 Replies View Related

Exec, Passthru Disabled So How To Call C++ .exe File?

Jul 17, 2005

I am at my wit's end trying to get information out of Streamline.net's
support dept about my problem. They reply quickly enough, but seem to try
and give out the least possible amount of info each time. The transcript so
far is reproduced for your amusement below.

To summarise:

I've put up a Sudoku-solving program called Sudoku.exe. I want to call it in
a php script to solve a puzzle and output the solution. It works fine with
Apache/php on my own machine, but it seems Streamline.net disable exec,
passthru etc. They eventually say, cryptically: ' CGI executables are
supported, however this is very different from executing a program from
within a PHP script'. So how would I call my Sudoko.exe file?

The 'dialog':

My last question seems to have been 'fixed' before being answered, so I'll
have another go.
I'm trying to call an .exe file on the server but get an 'unable to fork'
error message. I have Apache/php installed locally and it works fine. Do you
have to turn on 'cmd.exe' permissions or something? Try it yourself at:

Warning: passthru(): Unable to fork [Sudoku.exe (argument...)] in (.php
file...)
It's the same with exec() as well.

We do not support passthru or exec functions.

So how would I call my Sudoku.exe program from a php script?

I do not want 'scripting help', I just want to use some of the functions
that you offer as a host and which I have paid for.
As I have said what I am trying to do works perfectly on my machine, so it
must be a question of something you have to enable your end. What do you
mean you don't support passthru or exec? They are both standard php
commands.
.

You asked "how would I call my Sudoku.exe program from a php script?"
clearly this is asking us how you can use scripting?

Certain functions are disabled in PHP for security reasons.

Which functions are 'disabled in PHP for security reasons' ?

You can find this out with the inbuilt php function phpinfo()

Could you tell me where on the page that phpinfo() produces these functions
are listed? For example, passthru() does not appear to be on the page.
.

search for "disable_functions" on that page.

disable_functions lists 'no value'. So again, could you tell me where I can
find the list of standard php functions which you have disabled?
Please can you provide a link to your phpinfo file so we can investigate
this further.
We had previously checked this on a linux server, which showed the functions
that have been disabled. We've passed this on to an engineer to investigate
further.

For your information the following are disabled:

shell_exec,exec,system,passthru,popen

Your knowledge base says:
Q. Are CGI (Common Gateway Interface) executables supported?

A. Yes these are supported on either the Windows and Linux servers

But you are telling me that the only php functions which can call my
executable are disabled. Will you clarify once and for all if I can call my
exe file or not. I AM NOT ASKING FOR SCRIPTING HELP, I have books about
that. I just want to know if I can do ON YOUR SERVER what you say I can do,
and if not why not.

View 2 Replies View Related

ADVERTISEMENT