Uutiset:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu
Advertisement:

Latests posts on html page.

Aloittaja JCphotog, marraskuu 03, 2005, 10:42:15 IP

« edellinen - seuraava »

JCphotog

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?

kegobeer

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.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

Dannii

An HTML page is static, so no. However it is very easy to do such things with php through SSI.php
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

JCphotog

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...

Kindred

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!)
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

JCphotog

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 :)

kegobeer

You have to rename your index.html file to index.php.  Your SSI includes will work then.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

ymmotrojam

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...

::)

JCphotog

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!

Kindred

#9
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"); ?>
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

JCphotog

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!


kegobeer

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
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

Advertisement: