Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Twitter
Powered by Vanilla. Made with Bootstrap.
Theme built by Kasper Kronborg Isager
if menu item exists
  • hey there.
    i want to check if a menu item exists in a category,(or to be more precise, if a page exists in a category) if it does i want to echo the item and in not i want to echo a custom message.
    can you help me figure out how to to this?
    this is what i use now:
    foreach($feindura->createMenu('category',12,'ul.list1') as $item) { 
    echo $item['item'];
    }

    Regards,
    Ofer
  • hey, did you miss this by any chance? can you help me with this one?
    the menu code works just fine but i cant figure out how to echo a message like "there are no items in this category" if category is empty.
    cheers
  • i currently working full time as javascript developer, therefore feindura is on a hold. i also didn't code php in a while :)

    but you could simply check if the returned createMenu array is empty and echo something if it is like so:
     
    $items = $feindura->createMenu('category',12,'ul.list1');
     
    if (empty($items)) {
     
    echo 'There are no items in this category.';
     
    } else {
     
    foreach($items as $item) {
    echo $item['item'];
    }
     
    }