View Single Post
  #4  
Old 03-13-2016, 09:17 AM
 
xgarb xgarb is offline
 

eXpert
  
Join Date: Jul 2004
Location: UK
Posts: 263
 

Default Re: Show/hide in template with flexy If statement and config data

I must have been doing something wrong somewhere as now a simple function like..

Code:
public function getWidth() { return \XLite\Core\Config::getInstance()->Tienda->myWidget->data_width; }

with
Code:
{if:getWidth()}width="{getWidth()}"{end:}
in the template is working perfectly.

If the option is left blank in the module settings then the whole line isn't shown.

I thought I might need something a little more complex like
Code:
public function getWidth() { $dataWidth = \XLite\Core\Config::getInstance()->Tienda->myWidget->data_width; return !empty($dataWidth) ? $dataWidth : false; }
but it doesn't seem necessary.
__________________
Core version: 5.5.xx
Reply With Quote