Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product
Please upgrade to 2.3 here. The 2.2 and earlier branches are no longer being updated.

What does {asset name="xyz"} do?

Hi,
I'm trying to track down what is going on when a template file includes something like the following: " {asset name="Panel"}". I've been looking through the documentation for some reference to this, but nothing has made it clear. Can someone explain? Is this somehow calling a controller, even though it is in a template?

Comments

  • it is using smarty. I believe it is essentially it get the asset for the specific controller and displays.

    look at library/vendors/SmartyPlugins/

    and function.asset.php

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    fraxture
  • @peregrine, does the side panel have its own controller then? basically, i'm trying to hunt down how to add stuff to the side panel, which i guess needs to be done via the controller...?

  • peregrineperegrine MVP
    edited December 2013

    I think you are confused a bit.

    assets are contents panel footer header.

    there is no controller per se for a particular asset.

    look at the forum donate plugin. it is about the simplest plugin there is for adding a side
    panel

    http://vanillaforums.org/addon/forumdonate-plugin

    there are lots and lot of plugins that do this. also look at @whu606 's plugins

    http://vanillaforums.org/profile/addons/19918/whu606

    he has written some very nice explanatory plugins for the themes panels and assets.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    fraxture
  • hgtonighthgtonight ∞ · New Moderator

    Every controller has a bunch of modules; each module has a specific asset it renders to. The smarty tag {asset name="AssetName"} just indicates what batch of modules should be rendered. There are four common assets as @peregrine mentioned: panel, footer, header, and content. You can use any name you want. In my communities theme, I had a breadcrumbs asset that I was doing some funky stuff with. If you start reading up on modules, you notice that they all have a method called AssetTarget() which returns where that module should be rendered.

    If you are creating a module, just have the AssetTarget() method return 'panel' and that is where it will be rendered. You still need to attach it to a specific controller via an event hook. ($Sender->AddModule('ModuleName'); works in general).

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

Sign In or Register to comment.