def menu_list_loop(menuid, sub = false)

      # check to see if it is a sub menu
      if sub
        data = MenuOption.find(menuid)
        data = MenuOption.where(:parent_id => data.option_id)
      else
        data = MenuOption.where(:menu_id => menuid, :parent_id => nil)
      end

      html = ''

      data.each do |m|

        if m.parent_id != 0

          # below creates the necessary vairbale for the html view
          existingData = make_hash m.custom_data
          name = existingData['label']

          if name.to_s.blank?

            if m.data_type == 'pages' || m.data_type == 'posts'
              opt = Post.find(m.option_id)
              name = opt.post_title
            elsif m.data_type == 'custom'
              name = existingData['customlink']
            else
              opt = Term.where(:id => m.option_id)
              name = opt.name
            end
          end

          # allow the view to see these variables
          @option = m
          @existingData = existingData
          @name = name

          # add each block to the html variable
          html += render :partial => 'roroacms/admin/menus/partials/menu_list_loop'

        end
      end

      html.html_safe

    end
def menu_list_loop(menuid, sub = false)

      # check to see if it is a sub menu
      if sub
        data = MenuOption.find(menuid)
        data = MenuOption.where(:parent_id => data.option_id)
      else
        data = MenuOption.where(:menu_id => menuid, :parent_id => nil)
      end

      html = ''

      data.each do |m|

        if m.parent_id != 0

          # below creates the necessary vairbale for the html view
          existingData = make_hash m.custom_data
          name = existingData['label']

          if name.to_s.blank?

            if m.data_type == 'pages' || m.data_type == 'posts'
              opt = Post.find(m.option_id)
              name = opt.post_title
            elsif m.data_type == 'custom'
              name = existingData['customlink']
            else
              opt = Term.where(:id => m.option_id)
              name = opt.name
            end
          end

          # allow the view to see these variables
          @option = m
          @existingData = existingData
          @name = name

          # add each block to the html variable
          html += render :partial => 'roroacms/admin/menus/partials/menu_list_loop'

        end
      end

      html.html_safe

    end
Returns the menu options in a html format for the admin editing area
 Params:
 +menuid+:: the id from the "menus" record
 +sub+:: is true if it is a sub menu