Page 2 of 2

Posted: Sun Sep 11, 2005 7:34 am
by feyd
SSI will not parse inside of php unless SSI knows it can, but then it ceases to be php... ;) Could you start using the code posting tags like

Code: Select all

and

Code: Select all

please?

Posted: Sun Sep 11, 2005 7:18 pm
by nparekh
Hi feyd

Thanks for your reply.

I'd love to use

Code: Select all

and

Code: Select all

but have no idea how to!  

If you could possibly give an example I'll try it out immediately.

I presume you mean use

Code: Select all

instead of <?php but where do I use the

Code: Select all

portion?

Thanks in advance

Nikhil

Posted: Sun Sep 11, 2005 7:31 pm
by feyd
read the first link "How to Post Code on DevNetwork" in my signature..

Posted: Sun Sep 11, 2005 7:53 pm
by nparekh
Thanks feyd :wink:

Ok heres my results now-the code below is for a file called rotate.php:

Code: Select all

<?php

    $art = mt_rand(0, 50);
    if($art == "0") {
        include("article.inc");
    } else {
        include("article" . $art . ".inc");
    }

?>
The results are ok when I open the rotate.php file in a browser as displayed below:

Code: Select all

test 3
However when I use this code on my main site nothing appears on my main site:

Code: Select all

<!--#include virtual="rotate.php-->
I have tried with the <php> tags as well but because my host only supports SSI I am just getting a blank space where the results (test.txt etc should be displayed)

Any advice please?

Nikhil

Posted: Sun Sep 11, 2005 7:56 pm
by timvw
Might want to add a shebang with the right path to the php executable in your rotate.php file ;)

Code: Select all

#!/usr/bin/php 
<?php
...
?>

Posted: Sun Sep 11, 2005 8:25 pm
by nparekh
Hi Tim

Thanks for replying.

When I open the rotate.php in a browser I get the files to rotate. However.............

I added the following to the php file rotate.php:

Code: Select all

#!/home/nparekh/public_html/mortgage
<?php

    $art = mt_rand(0, 50);
    if($art == "0") {
        include("test.txt");
    } else {
        include("test" . $art . ".txt");
    }

?>
The code on the main website is in a file and the code is as follows:

Code: Select all

<!--#include virtual="rotate.php-->
Still get a blank space where results should go - so sorry for the hassles!

Thanks again

Nikhil

Posted: Mon Sep 12, 2005 3:19 am
by timvw
nparekh wrote:

Code: Select all

#!/home/nparekh/public_html/mortgage
Ok, you haven't read (or understood) the links i provided. You would need to add the path to the php interpreter (not the scripts). For example if php-cli.exe is in c:/php you would need !/c:/php/php-cli.exe. On a unix webhost, the interpreter is usually at /usr/bin, /usr/local/bin, .. ("which php" in a shell will give a good hint)