...

View Full Version : Include .php file with javascript



iccy
03-26-2007, 09:45 PM
Hi

I wanted to include a .php file but using javascript or anything else that can be called from a .html page. I am trying to call a php file from VBulletin header template file and I tried putting the include() fucntion from php but that didn't work so thats why I am looking for another way to call a .php file.

Any help greatly appreciated.

Thanks

rafiki
03-26-2007, 09:52 PM
why didnt the php include() work?
javascript is actually executed on the wrong side to include, show your code with the include() function on, and show us whats inside the included page and what your expecting to happen
thanks

Fumigator
03-26-2007, 10:06 PM
Aye, as rafiki mentioned, PHP is server-side; once the browser has the file PHP is done with it and Javascript can't do anything related to PHP. That's like trying to tighten a nut with a hammer.

Read this:

How PHP works (http://www.php.net/manual/en/getting-started.php)

Then you can begin to consider solutions to your problem (such as Ajax).

iLLin
03-27-2007, 05:05 AM
You can use AJAX to dynamically call new files. How do you think this quick post works?

Inigoesdr
03-27-2007, 05:12 AM
That was already stated...

Then you can begin to consider solutions to your problem (such as Ajax).

iLLin
03-27-2007, 05:43 AM
Whoops totally missed that. What Fumigator said :p

iccy
03-27-2007, 06:28 AM
Thanx for the replies.

Ok now when I try to put the include(''); function to call the php file all it does is out it like this
include("/home/sitename/public_html/forums/header.php");
it doesn't actually output it and show the tables etc. The file in which I m trying to include this php file is a template file .tmp and is actually stored inside mysql database, thats why I am looking for another way to include a php file.

How can I do it with AJAX? is it possible?

iccy
03-27-2007, 06:37 AM
I got it using AJAX yayyy :D..

thankx alot though



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum