Simple Machines Community Forum

SMF Development => Feature Requests => Applied or Declined Requests => Aiheen aloitti: JCphotog - marraskuu 03, 2005, 10:42:15 IP

Otsikko: Latests posts on html page.
Kirjoitti: JCphotog - marraskuu 03, 2005, 10:42:15 IP
Hi.  I'm curious if there's a hack out there that will let me display 5 or 10 of the latest posts on the main page.

The forum is at yourdomain.com/forum and I'd like to put a table in yourdomain.com/index.htm that would contain the most recent posts.  Just to get people a bit more curious.

Does something like this exist for SMF?
Otsikko: Re: Latests posts on html page.
Kirjoitti: kegobeer - marraskuu 03, 2005, 10:54:28 IP
You should look at your SSI.php and ssi_examples.php files.  There are also many posts about SSI.php, and a few tutorials also.
Otsikko: Re: Latests posts on html page.
Kirjoitti: Dannii - marraskuu 03, 2005, 11:03:30 IP
An HTML page is static, so no. However it is very easy to do such things with php through SSI.php
Otsikko: Re: Latests posts on html page.
Kirjoitti: JCphotog - marraskuu 03, 2005, 11:24:58 IP
Hi.  I'm a little green, so I was wondering if you could give me a little more advice.  SSI.php seems to be a broad topic.  In phpbb I was looking at hacks like this: http://phpbbhacks.com/download/2057  it was  a drop in java hack that didn't require changes to your forum...
Otsikko: Re: Latests posts on html page.
Kirjoitti: Kindred - marraskuu 03, 2005, 11:36:18 IP
no changes required...

adding code like the following to any html page...

To use SSI.php in your page add at the very top of your page before the <html> tag on line 1:


<?php require("/home/kindred/public_html/forum/SSI.php"); ?>


and then the following where you want to include the posts...

<?php ssi_recentPosts(); ?>


for mroe, check out ssi_examples.php in your forum directory.
(call it up in your browser!)
Otsikko: Re: Latests posts on html page.
Kirjoitti: JCphotog - marraskuu 04, 2005, 12:33:55 AP
Thank you for the help.  For the second tag, do I need to use echo or something?  I tried putting both in the index file and no change happened.  Sorry I need a little hand holding :)
Otsikko: Re: Latests posts on html page.
Kirjoitti: kegobeer - marraskuu 04, 2005, 06:26:07 AP
You have to rename your index.html file to index.php.  Your SSI includes will work then.
Otsikko: Re: Latests posts on html page.
Kirjoitti: ymmotrojam - marraskuu 05, 2005, 10:38:24 AP
There are also ways of using javascript to retrieve rss feeds... They're somewhat slow in some cases, but that's always an option if for some reason you can run php on your server...

...but then again I don't know whether SMF makes a feed of the latest posts or not...

::)
Otsikko: Re: Latests posts on html page.
Kirjoitti: JCphotog - marraskuu 07, 2005, 01:14:20 IP
Renaming the file did the trick.  I've never had much experience formating in .php results.  Do you have any advice on how to adjust the font and limit the width of the results in a table or something similar?

Thanks again.  I find advice on forums like this to be so valuable!
Otsikko: Re: Latests posts on html page.
Kirjoitti: Kindred - marraskuu 07, 2005, 05:57:54 IP
well, to do that, you'll need a little more...

go into SSI.php, copy out the entire function, into a separate file.
Make modifications to the CSS calls and displays in the now copied function...

replace the <?php require("/home/site/public_html/forum/SSI.php"); ?>  with <?php require("/home/site/public_html/forum/NEWFILE.php"); ?>
Otsikko: Re: Latests posts on html page.
Kirjoitti: JCphotog - helmikuu 21, 2006, 12:53:20 IP
Hi.  I had to put this on the back burner for a second, but I'm back at it now, and was wondering if you could give me a little more detail on what to modify to change the CSS calls and displays.  I'm not very well educated on this. 

Also, in your expereince, can you use SSI.php on an exeternal site?  A freind of ours is developing a simlar site, and would like to post a window with our latests posts for their users to view?

Thanks so much for the help to a newbie!

Otsikko: Re: Latests posts on html page.
Kirjoitti: kegobeer - helmikuu 21, 2006, 01:08:39 IP
You don't have to copy the SSI.php function at all, you can just return the values in a variable instead of letting SSI.php format your HTML output.  You can also edit your theme's style.css and add a ssi_table class.  If you search the boards for ssi_table, you'll find topics like this one:

http://www.simplemachines.org/community/index.php?topic=10094.msg91447;topicseen#msg91447

About how to return values from SSI.php functions, I would read these posts:

SSI FAQ's (http://www.simplemachines.org/community/index.php?topic=14906.0)