Warning: Invalid argument supplied for foreach()

5 posts by 2 authors in: Forums > CMS Builder
Last Post: July 9, 2013   (RSS)

By jenolan - July 9, 2013

Add like this not real code only the 'logic'

if( is_array( $theWidget ) )
    foreach( $theWidget AS ... )
else
    cat is empty

---
<?= "Jenolan(Larry) :: Coding Since 1973" ?>
Peace and Long Life

By Toledoh - July 9, 2013

Thanks Larry, but I didn't explain well enough.

The aim is to produce;

Heading 1
- item
- item

Heading 2
-item

Heading 3
-item
-item

However, if there is no item under Heading 2... not show heading 2.

Cheers,

Tim (toledoh.com.au)

By jenolan - July 9, 2013

If it is the suppliers foreach that you want to stop the heading appearing before putting out the heading do something like;

if count( supplier_array )
{
  emait heading then the supplier foreach etc
}

gimme a yell on skype code_gooroo and I will do the code if you need it.

---
<?= "Jenolan(Larry) :: Coding Since 1973" ?>
Peace and Long Life

By Toledoh - July 9, 2013

Thanks Larry...  you were right the first time, I was just putting the code in the wrong place.  Much appreciated!

Cheers,

Tim (toledoh.com.au)