News:

Wondering if this will always be free?  See why free is better.

Main Menu

SSI Within a Template?

Started by Overseer, August 06, 2003, 05:48:50 AM

Previous topic - Next topic

Overseer

I hope to use SSI to include some custom scripts in my template... for 3 purposes

1) a randomised section for adverting my affils. they each get a short text description/a small banner/ and a link..

2) a news feed from my sister news site (it will have an rss feed when they're done writing the scripts..) (i know i cant SSI from outside my domain)

3) an advertising banner script (so i only have to change this to update adverts, and not every page on the site)


So far i've done a little investigation with SSI.. seems like the pages have to be called .shtml to get it to work. and other than that i'm pretty much lost.. for now.

۞

With YSE you could use php in the template to the same effect:

<? include('mypage.html'); ?>

I'm guessing it will be the same with SMF :)
TTTTTT  OOOOOO MMMMMM   BBBBBB


Overseer

cool thx, sounds real easy  :D

the only thing i now see 'issues' with now is how to get the output from the news on the other site onto my board.


is it possible to write a php script that 'copies' the page returned from a script (also php, but i guess that doesnt really matter) running on the other site  as the output from the local script?

(so basically a page, i know i can query the scripts on the other site with parameters, they're being custom written by a firend)

۞

TTTTTT  OOOOOO MMMMMM   BBBBBB


alienine

If it was I'd be swimming in red wine with naked women all around me... don't you say anything is possible.....

vincent

Even THAT is possible alienine...
Life is what happens to you while you're busy making other plans - John Lennon

alienine

ok true.. I said that in the hope a winery run by about 20 beautiful women would read my post and try and prove me wrong

Overseer

LOL... back on topic.... how?  ;D

something like the following - lol

---
$output  = readpage( "http://www.sistersite.com/news.php?style=simplenews;stories=3;justheadlines=1" );

echo $output
------

alienine

is it just me or you don't need to use SSI just like 10 lines (max) of php code?

Overseer

for which part?

it certain seems its not strictly ssi now...

and since its not.. does the 'not outside your domain' rule apply?


alienine

depending on your hosts php config you can do anything from loading up other people's pages to running your house.

Overseer

ok well assuming my host will let me run my house what do I call to load up someone elses page and spit it out as my scripts output?

۞

You should be able to just use <? include('http://url.com/to/page.html'); ?>
TTTTTT  OOOOOO MMMMMM   BBBBBB


Overseer

sweeeeeeeet  ;D

i've got full access to the other site.. back with results later!

Overseer

ok i've done it.

you cant use <? include('mypage.html'); ?>  to include a page on a remote site.

here is my script...

<?
echo "<!doctype html public \"-//W3C//DTD HTML 4.0 Transitional//EN\"><html>";
echo "<br>~inctest~<br>";
include 'local.php';
echo "<br>";
$target = "http://www.anothersite.com/remote.php";
$html = implode ('', file ( $target ));
echo $html

?>



remote.php contains...

<?
echo "remote";
?>

local.php contains...

<?
echo "local";
?>



kinda cool.. i'm ggonna have to do some additions for 1)errors loading and that kinda thing.. but that should be too much hassle!

[Unknown]

I'd just like to say: there are reasons why you can't use SSI in a template, namely that it's parsed 100% by PHP.  Instead, you should use PHP like these people have told you.

Second rss is done by SMF ;).

-[Unknown]

Overseer

cool... I might have to do it this way for now, and switch to .rss later when the new scripts for that site are done. right now its using 'newspro' (flat file perl news system with no rss support).


Advertisement: