| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Show/hide in template with flexy If statement and config data | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Show/hide in template with flexy If statement and config data
Following the example here:
http://kb.x-cart.com/display/XDD/Flexy+Guide I have this in my template: {if:getWidth()} width="{getWidth()}" {end:} I want to show width="{getWidth()" in my template only if getWidth has been set. The method looks like this: Code:
where data_width is a user setting in the admin area of the widget. If this setting is left blank, I don't want the text in italics above to show. I've tried return false and NULL and the text is still shown. Is my only option to use != or <> '' in the IF statement?
__________________
Core version: 5.5.xx |
|||||||
#2
|
|||||||||
|
|||||||||
Re: Show/hide in template with flexy If statement and config data
Is it possible that the getWidth method is pulling from somewhere else?
If you are returning false, it seems that your code above should be working.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey XcartGuru X-cart Tutorials | X-cart 5 Tutorials Check out the responsive template for X-cart. |
|||||||||
#3
|
|||||||||
|
|||||||||
Re: Show/hide in template with flexy If statement and config data
I think you need 2 functions - one to check if the width is set and another to return actual width. The if statement works with true/false values
Code:
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
|
#4
|
|||||||
|
|||||||
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:
with Code:
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:
__________________
Core version: 5.5.xx |
|||||||
|
#5
|
|||||||||
|
|||||||||
Re: Show/hide in template with flexy If statement and config data
For simple cases like this, when you need to check if a module setting is configured, a single method should be enough.
For more complex cases it is recommended to have the second method so that it could be extended and tweaked from another module (when needed).
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
|
|||
X-Cart forums © 2001-2020
|