Using Includes (SSI/PHP)
mark99 9
From: -
From: -
Notice
This topic is archived. New comments cannot be posted and votes cannot be cast.Responses to this topic
1 Re: Using Includes (SSI/PHP)
Philipp Esselbach
From: -
Editor
0From: -
Try to replace include() with virtual():
virtual() seems to have the same functionality that SSI offers, but it will not work on all servers.
virtual("rss/feed2html.php");
virtual() seems to have the same functionality that SSI offers, but it will not work on all servers.
1 Re: Using Includes (SSI/PHP)
mark99
OP
9
From: -
From: -
That works for flat text files, but the PHP RSS output and my own survey system (that I intend to keep because it's well indexed and recognised) generate their content semi-dynamically. So how would I go about showing this in the style?
http://www.ispreview.co.uk/cgi-bin/polls/ssi.cgi?08hours
Obviously this would normally be called with SSI.
http://www.ispreview.co.uk/cgi-bin/polls/ssi.cgi?08hours
Obviously this would normally be called with SSI.
1 Re: Using Includes (SSI/PHP)
Philipp Esselbach
From: -
Editor
0From: -
You can't use server side includes in the templates; instead you need to do it with PHP.
Here an example to include the output of an external PHP script:
PHP Part:
HTML Part:
To include a text file:
PHP Part:
HTML Part:
Here an example to include the output of an external PHP script:
PHP Part:
ob_start();
include("rss/feed2html.php");
$feed2html = ob_get_contents();
ob_end_clean();
HTML Part:
{$feed2html}
To include a text file:
PHP Part:
$tfile = fopen("review/latest.txt","r");
$latest_reviews = fgets($tfile, 4096);
fclose($tfile);
HTML Part:
{$latest_reviews}
More questions, I know you love them .
On my front page I also have a number of includes, all using SSI and most including .txt files (example below includes output from a PHP) from forums and other output. Here's one example I use:
<!--#include virtual="../../rss/feed2html.php"-->
http://www.ispreview.co.uk/rss/feed2html.php
There's also this for the easier .txt file include:
<!--#include virtual="../../review/latest.txt"-->
http://www.ispreview.co.uk/review/latest.txt
Now I've tried adjusting the ../../ bit to the direct path depth and it works from my CT dir in a test.shtml file but not from inside CT. I've also tried a php include, although this doesn't work either and I can't use that for the RSS include anyway because that's from another .php script. What's the best solution here?