Choose which template hook to put it in.

Matthew Hawley

Well-known member
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.

ad_locations1.jpg


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?
 
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;
}
 
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.
 
Why do i want to do that? I already know which template I want to use.
Sorry I didn't read all your request.
I want users to have the option of where they want to put the server block via a drop down list in the options.
If you want to make an option allow users can select so You need make an custom field or create new column then save position :)
 
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
 
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 :)
 
Back
Top Bottom