Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

is there a Smarty tag equivalent to $this->FireEvent() ?

codegruntcodegrunt New
edited January 2011 in Vanilla 2.0 - 2.8
Howdy. I am currently working on theming my Vanilla Forums install and the current order of business is to setup a default.master.tpl Smarty template. Looking at the PHP version, I notice that the following method is called towards the end, presumably so that plugins can do something after the main page content has been rendered:

<?php $this->FireEvent('AfterBody'); ?>

The docs for template tags are here:

http://vanillaforums.com/blog/category/help/template-tags-help-topics/

There is no mention of the FireEvent call in the above list and the default.master.tpl template found under the stock mobile theme also does not have anything like this in it.

So my question is whether there is a Smarty based way to keep the same functionality or do we lose the ability to have plugins called via events if we go with Smarty templates over the PHP based views? It is definitely preferable to reduce to the amount of layout tangled up with program logic which is why going with Smarty for the templates is very much preferred.

Cheers

Comments

  • TimTim Vanilla Staff

    Vanilla Forums COO [GitHub, Twitter, About.me]

  • After some digging I found that events can be called in this fashion:

    {event name="BeforeCommentBody"}

    Unfortunately, there are context issues that affect loops in Smarty so for example, the above event will only see the first row's data if called in "themes/mytheme/views/discussion/index.tpl".

    Any know of a way to control what gets passed to the event at the Smarty template level to work around this?

    Cheers
  • How can I achieve {searchbox} using PHP rather than Smarty? We have "RenderAsset", but is there a "RenderTag"?

  • CurtisOden said:
    How can I achieve {searchbox} using PHP rather than Smarty? We have "RenderAsset", but is there a "RenderTag"?

    look at the default master the example is right there

            <div class="Search"><?php
                    $Form = Gdn::Factory('Form');
                    $Form->InputPrefix = '';
                    echo 
                        $Form->Open(array('action' => Url('/search'), 'method' => 'get')),
                        $Form->TextBox('Search'),
                        $Form->Button('Go', array('Name' => '')),
                        $Form->Close();
                ?></div>
    

    grep is your friend.

  • @x00, thanks as always!

    Just to clarify, for anyone as obtuse as me, the location of the default master is (assuming your root is /vanilla):

    /vanilla/applications/dashboard/views/default.master.php

Sign In or Register to comment.