News:

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

Main Menu

Would like "Info Center" on recent.php

Started by SMAguy, September 18, 2005, 12:37:28 AM

Previous topic - Next topic

SMAguy

I have decided to make the 10 most recent posts my default main page on my forum, which I've done with the exception of the Info Center, which I would like to also display.  Actually, I can sort of display it but I don't believe it is querying for the necessary information (as does, I believe, BoardIndex.php).  SSI looks a little messy and complicated (I really want it to look identical to the Info Center in BoardIndex).  Is there a relatively simple way to accomplish this?  Need I paste a bunch of code from BoardIndex.php into recent.php (in addition to the pasting between their respective template files)?

'zenybody know?

SMAguy

Okay, then, perhaps I should re-phrase the question:

If I want my main forum page to be the recent.php page (thus showing the last 10 posts by default), but otherwise want it to retain the features of the usual SMF main page (Boardindex.php), including the "info center", do I have to use SSI and parse the arrays it returns, or would that require about as much overhead as just sticking the relevant code (it appears to be alot!) from Boardindex into recent.php?

bloc

Sticking code from a source file into another is a bad idea...both for upgrading reasons and for it actual working...

But I am somewhat confused..the boardindex ( = info center) alreay have recent posts..Do you want the actual posts to appear there too (like index.php?action=recent) instead of just the titles?

SMAguy

#3
Boy I have really not expressed myself clearly!

The boardindex, as I understand it, is NOT the info center.  The Info Center is what appears BELOW the boardindex (look at the main SMF forum page, and you'll see it entitled as "Simple Machines Community Forum - Info Center" just BELOW the actual board index.  As far as I can tell, boardindex.php is the only file that displays this Info Center, but I want the recent posts page (i.e. recent.php, the whole page listing, not just the link IN the Info Center), to ALSO display the Info Center.  Kapiche?

So, YES I DO want the actual posts to show there!  I do want recent.php to be loaded by default instead of boardindex, but I still want to display the Info Center at the bottom.  Well, I guess actually I would want to nuke the "recent posts" section of that Info Center, but the rest I would still want to display.

What is the best way to do that?  Do I have to insert dones of SSI calls to accomplish this (after pasting sections of the boardindex template file into the corresponding recent.php template file?)

bloc

yes, using SSi.php is best for this. All the functions of info center is already in functions in SSI, so all you have to do is to put the output of them into arrays, and render them somewhat like the tables in the actual info center. Just call them through the template file.

This will make sure both SSI upgrades and SMF upgrades work fine - whereas if you change the actual source files , they will be overwritten when upgrading. unless you make a mod out of it.

SMAguy

Yes, but this seems to require nearly building that part of the template from the ground up.  All the "$context[]" variables, for example,  don't seem to work in recent.php. 

bloc

$context is only filled what you need in any specific tempalte.

No, I was talking about using SSI and those functions to mimic Info center. Online users = > ssi_whosOnline() for example.

These will help:
ssi_recentTopics();
ssi_boardStats();
ssi_todaysCalendar();

Now, most of them will just execute when called (and they don't do much different than actual info center, so the load shouldn't be that much higher) , and render a certain way. But to render the output more like actual info center (tables etc.)  , one clever thing is built-in: the ability to call it with an array, like:

$myholidays = ssi_todaysCalendar('array') .

Then you can foreach this array and output any way you like. Thereby having your "info center" anywhere where this is called. I would suggest just setting it all up in a function in index.template.php and then call it from any template - since index is always loaded.

Advertisement: