Simple Machines Community Forum

Customizing SMF => Graphics and Templates => Topic started by: Overseer on August 06, 2003, 05:48:50 AM

Title: SSI Within a Template?
Post by: Overseer on August 06, 2003, 05:48:50 AM
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.
Title: Re:SSI Within a Template?
Post by: ۞ on August 06, 2003, 05:55:58 AM
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 :)
Title: Re:SSI Within a Template?
Post by: Overseer on August 06, 2003, 06:01:58 AM
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)
Title: Re:SSI Within a Template?
Post by: ۞ on August 06, 2003, 06:24:11 AM
Anything is possible :P
Title: Re:SSI Within a Template?
Post by: alienine on August 06, 2003, 06:29:32 AM
If it was I'd be swimming in red wine with naked women all around me... don't you say anything is possible.....
Title: Re:SSI Within a Template?
Post by: vincent on August 06, 2003, 06:36:14 AM
Even THAT is possible alienine...
Title: Re:SSI Within a Template?
Post by: alienine on August 06, 2003, 06:46:21 AM
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
Title: Re:SSI Within a Template?
Post by: Overseer on August 06, 2003, 06:47:12 AM
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
------
Title: Re:SSI Within a Template?
Post by: alienine on August 06, 2003, 06:54:44 AM
is it just me or you don't need to use SSI just like 10 lines (max) of php code?
Title: Re:SSI Within a Template?
Post by: Overseer on August 06, 2003, 08:59:05 AM
for which part?

it certain seems its not strictly ssi now...

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

Title: Re:SSI Within a Template?
Post by: alienine on August 06, 2003, 09:33:08 AM
depending on your hosts php config you can do anything from loading up other people's pages to running your house.
Title: Re:SSI Within a Template?
Post by: Overseer on August 06, 2003, 09:52:31 AM
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?
Title: Re:SSI Within a Template?
Post by: ۞ on August 06, 2003, 10:09:34 AM
You should be able to just use <? include('http://url.com/to/page.html'); ?>
Title: Re:SSI Within a Template?
Post by: Overseer on August 06, 2003, 10:11:33 AM
sweeeeeeeet  ;D

i've got full access to the other site.. back with results later!
Title: Re:SSI Within a Template?
Post by: Overseer on August 06, 2003, 04:09:55 PM
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!
Title: Re:SSI Within a Template?
Post by: [Unknown] on August 06, 2003, 07:26:00 PM
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]
Title: Re:SSI Within a Template?
Post by: Overseer on August 07, 2003, 05:10:10 AM
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).