• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Choose which template hook to put it in.

Matthew Hawley

Well-known member
#1
So on this addon http://xenforo.com/community/resources/ventrillo-viewer.2136/ (and the others), I want users to have the option of where they want to put the server block via a drop down list in the options.



Okay so on here http://www.gametracker.com/server_info/70.42.74.181:27666/b/ you can see the different block types. If a user chooses Ad_above_top_breadcrumb, Ad_below_top_breadcrumb, Ad_above_content, Ad_below_content, or Ad_below_bottom_content, then i want the block to be horizontal. If a user chooses Ad_sidebar_top, Ad_sidebar_below_vistor_panel, or Ad_sidebar_bottom, then I want the block to be vertical.

How can i achieve this?
 

Nobita.Kun

Well-known member
#2
You must create new option 'Select Menu': (ACP) ..
Data pataner:
Ad_above_top_breadcrumb = replace_new_name_0
Ad_below_top_breadcrumb = replace_new_name_1
...
In code PHP:
You must create new template_hook
PHP:
switch($hookName)
{
    case XenForo_Application::getOptions()->name_of_option:
        ...
        break;
}
 

Matthew Hawley

Well-known member
#3
You must create new option 'Select Menu': (ACP) ..
Data pataner:
Ad_above_top_breadcrumb = replace_new_name_0
Ad_below_top_breadcrumb = replace_new_name_1
...
In code PHP:
You must create new template_hook
PHP:
switch($hookName)
{
    case XenForo_Application::getOptions()->name_of_option:
        ...
        break;
}
Why do i want to do that? I already know which template I want to use.
 

Nobita.Kun

Well-known member
#8
You must create new option 'Select Menu': (ACP) ..
Data pataner:
Ad_above_top_breadcrumb = replace_new_name_0
Ad_below_top_breadcrumb = replace_new_name_1
...
In code PHP:
You must create new template_hook
PHP:
switch($hookName)
{
    case XenForo_Application::getOptions()->name_of_option:
        ...
        break;
}
This is you must to do
 

0xym0r0n

Well-known member
#9
This may not be the proper way but if you create an option in the admcp *there are tutorials on how to create options in the admincp*

Here is an example from one add-on I made to show prefixes
<xen:if is="{$xenOptions.showaPrefix} == 1">
SHOW THE CODE!
<xen:else/>
DONT SHOW THE CODE
</xen:if>

SO in your version of the application you would add code to each of those ad areas that checks to see if that option has been checked off in the admincp.
IE
ad_1 template is code --- if is= option.location1
ad_2 template is code --- if is= option.location2
ad_3 template is code --- if is= option.location3

I feel like there's a more efficient way to do this in your case. My case is a simple 1 page on/off type thing...

There is likely a more proper way to do it and I'm pretty sure that's what nobita was trying to explain with the hooks :)