[Solved] Product Module - If "empty" statement

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
welsfordvfd
Forum Members
Forum Members
Posts: 20
Joined: Tue Dec 16, 2014 4:48 pm

[Solved] Product Module - If "empty" statement

Post by welsfordvfd »

----------------------------------------------

Cms Version: 1.11.10

Installed Modules:

CMSMailer: 5.2.2
FileManager: 1.4.4
MenuManager: 1.8.6
ModuleManager: 1.5.5
News: 2.14.2
Printing: 1.0.4
Search: 1.7.11
ThemeManager: 1.1.8
TinyMCE: 2.9.12
FCKeditorX: 1.1.0
CGExtensions: 1.44.5
NMS: 2.3.2
FrontEndUsers: 1.25.1
CustomContent: 1.10
Calendar: 0.8.2
Showtime: 3.4
CMSPrinting: 1.0.5
MicroTiny: 1.2.6
JQueryTools: 1.2.6
CGSimpleSmarty: 1.7.4
Products: 2.21
CGEcommerceBase: 1.5.2
Cart2: 1.1.3
FormBuilder: 0.8
Uploads: 1.18.5
SelfRegistration: 1.8.3
Captcha: 0.5.0

Config Information:

php_memory_limit:
process_whole_template:
max_upload_size: 128000000
url_rewriting: none
page_extension:
query_var: page
image_manipulation_prog: GD
auto_alias_content: true
locale:
default_encoding: utf-8
admin_encoding: utf-8
set_names: false

Php Information:

phpversion: 5.6.4
md5_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
E_STRICT: 2048
E_DEPRECATED: 0
memory_limit: 128M
max_execution_time: 60
output_buffering: 4096
safe_mode: Off (False)
file_uploads: On (True)
post_max_size: 8M
upload_max_filesize: 128M
session_save_path: No check because open basedir active
session_use_cookies: On (True)
xml_function: On (True)
xmlreader_class: On (True)

Server Information:

Server Api: cgi-fcgi
Server Db Type: MySQL (mysql)
Server Db Version: 5.0.95
Server Db Grants: Found a "GRANT ALL" statement that appears to be suitable
Server Time Diff: No filesystem time difference found

----------------------------------------------

I am using the product module for our website and would like to show a link to instructions (pdf) only if the "instruction field" contains a value (link)..

This is what i currently have but it shows "PDF" for everything including ones which do not contain a link in the field. (Duh..)

What is the correct if/else statement one would use for something like that?

<a target="_blank" href="{$entry->fields.instructions->value}">PDF</a>

Thanks again!!
Last edited by welsfordvfd on Wed Feb 04, 2015 3:53 pm, edited 1 time in total.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Product Module - If "empty" statement

Post by velden »

Code: Select all

{if $entry->fields.instructions->value != ''}
<a target="_blank" href="{$entry->fields.instructions->value}">PDF</a>{/if}
welsfordvfd
Forum Members
Forum Members
Posts: 20
Joined: Tue Dec 16, 2014 4:48 pm

Re: Product Module - If "empty" statement

Post by welsfordvfd »

Well that was quick and simple! Thank you!
10010110
Translator
Translator
Posts: 224
Joined: Tue Jan 22, 2008 9:57 am

Re: Product Module - If "empty" statement

Post by 10010110 »

Alternatively: {if !empty($entry->fields.instructions->value)}
This also checks whether the property/field is defined at all. https://www.virendrachandak.com/techtal ... s-is_null/
Post Reply

Return to “Modules/Add-Ons”