Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: myndcraft - joulukuu 09, 2005, 01:32:50 IP

Otsikko: Need Help with SSI
Kirjoitti: myndcraft - joulukuu 09, 2005, 01:32:50 IP
I would like to show the recent posts on webpage. The problem is the websote is hosted on a different box then the forums. So made a test webpage that looks like this..

<?php

require("http://denovoforums.org/forums/SSI.php");

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>

<h3>Recent Topics Function: &lt;?php ssi_recentTopics(); ?&gt;</h3>
<?php ssi_recentTopics(); ?>

<h3>Recent Posts Function: &lt;?php ssi_recentPosts(); ?&gt;</h3>
<?php ssi_recentPosts(); ?>

</body>
</html>


but when I load the page it returns this:

Please don't access SSI.php by URL directly; you may want to use the path ('SSI.php') or add ?ssi_function=something.
Recent Topics Function: <?php ssi_recentTopics(); ?>

Is there any way to work around this since the site and forums don't live on the same box?

Thanks in advance.
Otsikko: Re: Need Help with SSI
Kirjoitti: myndcraft - joulukuu 12, 2005, 11:20:34 AP
/bump :-)

hate to do that, but just hoping someone who may have not seen this has an idea around the problem.
Otsikko: Re: Need Help with SSI
Kirjoitti: kegobeer - joulukuu 12, 2005, 12:04:38 IP
You can't include a file from a different webserver.  You should look into using RSS feeds.
Otsikko: Re: Need Help with SSI
Kirjoitti: Thantos - joulukuu 12, 2005, 01:19:08 IP
Well you "can" include a file from a different webserver.  However the problem you are running into is that what you are including is not the PHP code that you need but the output from the PHP engine on that server.
Otsikko: Re: Need Help with SSI
Kirjoitti: kegobeer - joulukuu 12, 2005, 02:35:31 IP
Let me clarify: you can't use an include or require statement to grab php files from another webserver.  If that was the case, there would be absolutely no security on the web.
Otsikko: Re: Need Help with SSI
Kirjoitti: Thantos - joulukuu 12, 2005, 02:36:32 IP
You can't use include or require to grab unparsed php files.  Slight difference :)
Otsikko: Re: Need Help with SSI
Kirjoitti: oxynom - joulukuu 12, 2005, 11:48:20 IP
Take advantage of IFRAME then...

Create a page on the server where your forum is and include the ssi file and call the functions you want to use...let's this page is called recent.php.

Now use IFRAME on the other server to display the file recent.php.

<iframe src="http://www.yourserver.com/recent.php"></iframe>

You might wanna use height and width (etc...) atributes to control the size of the frame.
Otsikko: Re: Need Help with SSI
Kirjoitti: gerrymore - joulukuu 13, 2005, 07:08:50 AP
Try using the absolute path to ssi, not the domain. It's available from the top of your ssi_examples.php.


require("http://denovoforums.org/forums/SSI.php");