Search code examples
phpsmarty

Custom block in Smarty


Basically, I'm currently working on a website that has a part for logged in users. I'm using Smarty for templating, and right now I check the session in a Smarty if/else block.

Is there any way I can make my own, custom block that would only show up when logged in? i.e. {loggedin}<ul with user menu />{/loggedin}?

I really don't know what this would be called or what the technical aspects of this would entail. If anyone can even point me in the right direction that would be very helpful.


Solution

  • Use the register_block() function to add your own smarty block.