The point is you wouldn't need code to hook into the template hooks.So how would you store the code you're hooking with? Database-stored?
The point is you wouldn't need code to hook into the template hooks.So how would you store the code you're hooking with? Database-stored?
Not really.Well, you'd need to store the code you're injecting, surely? If I was to use a hook to put {xen:helper dump, $someVar}, that code would need storing somewhere outside the template so it's not overwritten during upgrade. If there's no file to store it in, it'd only make sense that it was database stored?
<div id="foo">
{$bar}
</div>
<div id="foo">
<div id="foo">
<div class="addonContainer">
{$myOutput}
</div>
That's why i wroteWouldn't that cause a problem when you want to uninstall/disable an add-on, because it's basically just replaced the original code?
BUT(ok they could store if, if you want to uninstall the add-on, the system would need to undo the change)
<?php
class= GAB_Listener_Listener
{
public static funtion templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
{
if ($hookName == 'ad_below_top_breadcrumb')
{
$content .= $template->create('GAB_billboard');
break;
}
}
}
The parse error is due to the = sign after class.
Code:class= GAB_Listener_Listener
<?php
class GAB_Listener_Listener
{
public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
{
if ($hookName == 'ad_below_top_breadcrumb')
{
$content .= $template->create('GAB_billboard');
break;
}
}
}
Ahh.. I totally missed it.. Thank! But now, nothing shows up, I've tried injecting raw html and everything, but nothing comes up anywhere :/
Anything I'm missing?
Code:<?php class GAB_Listener_Listener { public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template) { if ($hookName == 'ad_below_top_breadcrumb') { $content .= $template->create('GAB_billboard'); break; } } }
Fatal error: Cannot break/continue 1 level in /home/cogumelo/public_html/comunidade/library/GAB/Listener/Listener.php on line 10
Thanks Arik, I got it to work, but I had to use return; because break; was giving me
Following the introduction of the mega footer here on XenForo.com, which I said was included using template hooks and requires no direct template edits, this video tutorial talks about template hooks, what they are and why you would want to use them.
It then goes on with a few examples to get you started.
$hookName, &$content, array $hookParams, XenForo_Template_Abstract $template
$hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template
That's true, but provided all the variable names marry up with each other, it doesn't matter what they are called at all.
I'm not sure I understand what you're saying - if you copy the function signature from your control panel and write your function using the variables you copied, it will work.Yes. But, in the video you advocate copying the function's signature. That means anyone copying you verbatim will get an error. I've helped a few people who have had two different variable names. Just trying to be proactive.
I'm not sure I understand what you're saying - if you copy the function signature from your control panel and write your function using the variables you copied, it will work.
On the other hand, if you copy my code in the example I posted, why would you copy the function signature from your control panel?
I'm genuinely confused, not trying to make a point or anything.
Source code changes?Some users would copy the signature but follow your instructions instead and enter the "content" variable instead of using the variable in the signature they copied.
Source code changes?
SINCE WHEN!
We use essential cookies to make this site work, and optional cookies to enhance your experience.