Define Vars | Correct Way

More
11 years 11 months ago #32241 by igcorreia
What is the correct way to define vars?
I am using the $custom1 filed from the module and I am trying this:
Code:
$unk_featured_items=$unk_featured_custom->items?$unk_featured_custom->items:1;

But I get undefind notice when the field is empty. :/

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago #32244 by ggppdk
Replied by ggppdk on topic Define Vars | Correct Way
Hello,
try using isset($varname)
Code:
$unk_featured_items = isset($unk_featured_custom->items) ? $unk_featured_custom->items : 1;


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago #32248 by igcorreia
Replied by igcorreia on topic Define Vars | Correct Way
worked like a charm. simple. easy and correct. thanks.

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.519 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline