How to do this kind of customization

How to do this kind of customization

Postby yihect on Fri Jan 14, 2011 2:05 am

Hi:
I'm a newbie to lifetype. Now I have a customization idea on my installed lifetyp version of 1.2.10.

I want to show somthing in stand template, like show a picture in head.tmplate if the blog's user set one config option to ON in his/her config page, and don't show anything if he/her set the option to OFF.

To achieve such results, what should be done??? Create a plugin which can let the user set ON or OFF of a option??? and expose that option into the header template??? How to do it? Is there some example to refer??? Thanks.
yihect
 
Posts: 5
Joined: Thu Jan 13, 2011 9:16 pm
LifeType Version: 1.2.10

Re: How to do this kind of customization

Postby jondaley on Fri Jan 14, 2011 3:59 am

I answered your other very similar question, but I also thought of maybe the TagCloud plugin is a good example for you. It has various settings that are set in the administration interface and then used in the template.

You might be able to simplify your template code by not having:

Code: Select all
{if $myplugin && $myplugin->isEnabled}
  {if $myplugin->getSetting()}
    show one thing
  {else}
    show another
  {/if}
{/if}


But, instead, put the logic into the plugin (and be a good model-view-controller programmer), and have:
Code: Select all
{if $myplugin && $myplugin->isEnabled}
  {$myplugin->showStuff()}
{/if}
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch


Return to Plugin Development Team

cron