PC Pals Forum

Technical Help & Discussion => Website Design & Programming => Topic started by: DJ on April 24, 2004, 20:23

Title: PHP in HTML
Post by: DJ on April 24, 2004, 20:23
Hi All,

I host a website in Force9's servers, I've got a php script (that produces a calander) on my cgi server and the main web pages on another normal 'homepages' server.

How do I embed the php script into the HTML page.

I tried the following in the HTML file,

Code: [Select]
<script language="php" src=http://cgi.blahblahblah.force9.co.uk/php/cal.php></script>

but it didn't work.

Any Ideas?

Cheers :thumb:

DJ
Title: Re:PHP in HTML
Post by: princeofdarkness on April 24, 2004, 20:33

Hi All,

I host a website in Force9's servers, I've got a php script (that produces a calander) on my cgi server and the main web pages on another normal 'homepages' server.

How do I embed the php script into the HTML page.

I tried the following in the HTML file,

Code: [Select]
<script language="php" src=http://cgi.blahblahblah.force9.co.uk/php/cal.php></script>

but it didn't work.

Any Ideas?

Cheers :thumb:

DJ








Code: [Select]
<script language="php"> src=http://cgi.blahblahblah.force9.co.uk/php/cal.php></script>


try that
Title: Re:PHP in HTML
Post by: DJ on April 24, 2004, 20:48
Thanks Jonah, I tried

Code: [Select]
<script language="php"> src=http://cgi.blahblahblah.force9.co.uk/php/cal.php</script>

and

Code: [Select]
<script language="php"> src="http://cgi.blahblahblah.force9.co.uk/php/cal.php"</script>

None worked. Should it have done  ???  Can you actially embed php direct in html?

DJ
Title: Re:PHP in HTML
Post by: Adept on April 25, 2004, 09:54
Try

Code: [Select]
<? include 'http://cgi.blahblahblah.force9.co.uk/php/cal.php'; >





The
Code: [Select]
<?

and
Code: [Select]
> are the correct begin and end markers for PHP code in HTML

the
Code: [Select]
include 'http://cgi.blahblahblah.force9.co.uk/php/cal.php';

tells PHP to load that file and interpret it as PHP code.

HTH
Title: Re:PHP in HTML
Post by: DJ on April 25, 2004, 15:34
Nope it didn't work either Adept.

I have sent a request to Force9 to see what they say. The problem I think is that the cgi server is separate to the HTML server and so linking the two is quite difficult.

For the time being I have used

Code: [Select]
<br />&lt;iframe src=&quot;http://cgi.blahblahblah.force9.co.uk/php/cal.php&quot;<br />&gt;&lt;/iframe&gt;&lt;/center&gt;<br />

Which works fine.

DJ
Title: Re:PHP in HTML
Post by: DJ on April 26, 2004, 10:22
I had a response from force9.

It states that as the two servers are separate (cgi and html) I can't embed php in a html document.

Instead I have referenced the php page in the place of my html page - and it seems to work ok.

Thanks all for the input

DJ
Title: Re:PHP in HTML
Post by: sam on February 04, 2005, 22:23
i know you have a resolution to this. a thought though. why did you have to run the php from the cgi bin? do they not have php installed as a module in apache - thus allowing you to just use php on the main webserver (where you have you html files in your case)?
Title: Re:PHP in HTML
Post by: DJ on February 04, 2005, 22:45
Hi Sam,

Cheers for the reply - you must have loads of posts to trawl your way through.

The way that my ISP (Force9) has its servers set is that one is normal HTML and one is CGI which they allow you to run PHP. Don't ask me why its the way they set them up!

I'm looking to transfer everything onto the CGI server soon (but need to chose the space limits they have etc).

Might be asking for your help soon  ;)

DJ
Title: Re:PHP in HTML
Post by: sam on February 04, 2005, 23:09
so they dont have php installed on their main webserver?? if so god that is a bit old school. i might even consider swapping hosts. I personally dont like to fill up my cgi bin with anything but scripts and since my site is 100% php (well mixed in with xhmtl) there is no way i could do it.

have you tried to run php from the main (html) webserver?

if you want you can figure out what they are running my creating a simple script:


Code: [Select]
<br />&lt;?php<br /><br />phpinfo();<br /><br />?&gt;<br />

and see what it returns you.

oh as for lots of posts.. yep i do.. gonna try and respond to any i can soon... i am also busy working on the site speed...and general maintanance