Helpful Information
 
 
Category: PHP Development
PHP and SSI on the same page?

Can I have PHP and SSI output on the same page?

If so, what do I need to add to my .htaccess file? I've tried various combinations, but so far I've managed to get only one or the other on my page.

Any help appreciated.
Thanks, Diana.

If you have Apache Web Server, you may be able to use the virtual() command in PHP to do SSI:

Exmample:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
if($banner):
virtual('/cgi-bin/banner.cgi');
endif;
[/code]

Its the only thing I've ever got to work.

Thanks Dave

I have, as you suggest, managed to mimic SSI using include and virtual. This is all I need most of the time. I would like to be able to use true SSI sometimes though on a page that also uses PHP. I suspect it's possible by tweaking the .htaccess. If I'm wrong would someone please let me know?
(And if I'm right, how do I do it?)

Thanks a lot,
diana.

I'm curious why you want to do this? There isn't anything that you can do using SSI that can't be done in PHP.

<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by rod k:
I'm curious why you want to do this? There isn't anything that you can do using SSI that can't be done in PHP.[/quote]

Well, I had the same problem. That is, if PHP isn't installed as an Apache module, you can't use the virtual() function.

I was referring to non-virtual() type SSI. Re-read the post I was replying to.

I have a 100-page+ site with lots of includes and scripts with SSI calls. I'm moving to a new server which supports PHP. I would like to add PHP functionality, without having to change everything.

So now that we've established WHAT I want to do, and WHY I want to do it, does anyone know HOW ?
:-}

<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by diana:
So now that we've established WHAT I want to do, and WHY I want to do it, does anyone know HOW ?
:-}[/quote]

Includes can be done in php using the include() function.
eg <? include ("header.txt") ?>

What kind of "scripts with SSI calls" do you have?


Basil










privacy (GDPR)