Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
themes-topic
Template functions confusion
Avatar
Tim O.
Member
Free Members
Offline
Sep 13, 2014 - 4:27 pm

I'm at a bit of a loss figuring out how to use the template functions. I see that a lot of the plugins require special coding for placement etc, but I'm new to this and really don't know how everything fits together. The codex doesn't seem to have that info in it yet. If someone could point me in the right direction, I would really appreciate it.

Thanks!

Avatar
Yellow Swordfish
Glinton, England
SP Master
Offline
Sep 13, 2014 - 4:30 pm

But... what is it you want to do?

andy-signature.png
YELLOW
SWORDFISH
Avatar
Ike
Sawtry, UK
Member
Free Members
Offline
Sep 13, 2014 - 4:35 pm

You tend to find that plugin calls already exist in the templates even if the plugin isn't installed. For example you will see all the basic forum functions, and then you will see 'if (function_exists'('sp_PluginName'))'

So you don't need to manually add each plugin in to the templates, the themes are designed with the plugins in mind.

As to customising a function, if you type the function name into the Codex search, it will give you a list of arguments to configure it how you want it to behave.

If you are more specific, we can be more specific!

Avatar
Tim O.
Member
Free Members
Offline
Sep 13, 2014 - 4:44 pm

Ok, to be more specific, it's the use of the template tags that confuse me. Let's say I want to use the "Answers Topic" plugin. The plugin instructions says I need the special templates functions to be installed, which I have done. Further down it gives an example of where to put it. But to put it elsewhere it looks like I need to delve in the arguments, actions and hooks....which is all new to me, so it looks like I need to do some homework to understand it all....? So, as I said, if you could point me in the right direction to figure out how to understand, use and manipulate all of these things, I'd appreciate it.

Thanks!

Avatar
Ike
Sawtry, UK
Member
Free Members
Offline
Sep 13, 2014 - 5:06 pm

Working from the 'Default' theme for example, if you open sp-resources/forum-themes/default/templates - then you have a template for every section of the forum. Open spTopicView.php - this template controls the layout and functionality of the topic page where the Answers Topic function is used.

If you have an editor capable of laying stuff out sensibly, scroll down to about line 172 and you should see the functions required for 'Answers Topic'

If you are referring to this codex article then the page does need updating as it is marked, so the information is not 100% current - but you have lost me when you say you have installed the template functions. It does clearly state 'If using any supplied themes from Version: 1.2.2 or newer the functions have been included for you'   -  so you shouldn't need to add anything, as I mentioned 'Default' themes topic view template and where to find that specific function. It might be worth making sure you have not doubled up by installing this yourself somewhere else.

As for manipulating the function to behave how you want it to, firstly find the function you wish to edit, copy the function name, for example 'sp_AnswersTopicAnswer' and paste it into the Codex search. Click the function and you will see a list of arguments that can be applied directly after the function in the template - examples are given on the Codex.

The Answers Topic function is a bit of a complicated one to start with however! Mostly the arguments involve CSS class names so there is not a huge amount you can do with it and it has a few different function calls for different stages of its use.

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626