News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Using template functions outside of smf

Started by xTyler, August 03, 2018, 07:21:25 AM

Previous topic - Next topic

xTyler

I would like to use the function template_info_center(); which is in BoardIndex.template on an custom page, I've called ssi and don't want to have to make my own info center using all the ssi functions.

What would I have to import to use it?


Thanks, Tyler

Arantor

You would need to load the template file, make sure all of $context and $txt are appropriately set up and then call the function. Which amounts to copying large chunks of BoardIndex.php.

xTyler

I think I've got most of it to work apart from it realising someone is online and the latest post?

(See attached)

Arantor

Which suggests not all of the guts of the info center were copied.

... what are you even trying to do?

xTyler

Quote from: Arantor on August 03, 2018, 08:18:06 AM
... what are you even trying to do?

Add the info center to custom pages as I have a Home page which I'd like the stats on and to make it look more in line with the overall theme of the website.

Arantor

That sounds like a long and complicated way of saying 'I could have used a portal mod'...

xTyler

For pure smf functionality yes, for what I want my site to be able to do and look like I feel I had to do it this way, I'll have to either just not have it or take the time to check every variable

Arantor

I dunno, some of the stuff I've done over the years, you'd never know it was SMF - and even some of the stuff being done now, you'd never know it was SMF powering it because an awful lot can be done with a portal and a theme.

Don't assume that SMF's functionality is as limited as you might think - great results can be had by having just one system at the heart. SSI is just one route, often the simplest but not necessarily the best and certainly not the most powerful.

I really should get my travel blog back up and running actually, that was a really neat SMF project using a WP theme and adding in the ability to geo-tag posts so they ended up showing a map of the journey in Google Maps.

Advertisement: