Retrieve forum ID inside template
Posted
#4593
(In Topic #926)
CNS_FORUM_IN_GROUPING.tpl
I'm working on a forum mod but I need to be able to grab the ID of the current forum in CNS_FORUM_IN_GROUPING.tpl.Unfortunately no existing parameters capable of grabbing this info are passed into the template that I can see, so is there a way to do this?
EDIT: I just created a new symbol, to pull the ID from the database. This seems to be doing what I need it to!
Last edit: by Joe
Posted
Posted
I can use the following to extract the ID from the URL:
Code
{$REPLACE,id=,,{$SUBSTR,{EDIT_URL},{$STRPOS,{EDIT_URL},id=},6}}(this supports up to a 3 digit forum ID #)
But, {EDIT_URL} isn't passed into the template if the current user is not allowed to edit the forum. So, this won't work as the user viewing the forums would need access to the ID. Also, the above solution can get buggy if there's additional variables in the URL, such as keep_su.
{FORUM_NAME} just returns the name of the forum and not the ID.
I also tried using {$FORUM_CONTEXT} by including the name of the forum as a parameter (hoping it would convert into an ID), but this identifier doesn't support parameters.
Posted
You can always find available parameters by putting in this temporary code {+START,PARAM_INFO}{+END}
0 guests and 0 members have recently viewed this.