douxiong5972 2014-05-08 14:04
浏览 33
已采纳

创建并理解CodeIgniter中水平菜单的操作

Good morning guys, I'm new to CodeIgniter, I want to create a horizontal menu, I've done this with HTML + CSS3, and when I click on the menu it goes to that page indicated, of course, using html, but I want to do in CodeIgniter. I've found the documentation, but it was not clear to me https://www.codeigniter.com/user_guide/helpers/url_helper.html can someone help me?

  • 写回答

1条回答 默认 最新

  • dporb84480 2014-05-08 14:58
    关注

    Creating a horizontal menu in CodeIgniter is a lot like creating it with plan HTML, only you're using CI helpers to create the anchors. A simple menu would be created like this:

    <ul id="menu">
        <li><?php echo anchor('controller/action', 'Link Text'); ?></li>
        <li><?php echo anchor('controller/action', 'Link Two'); ?></li>
        <li><?php echo anchor('controller/action', 'Link Three'); ?></li>
    </ul>
    

    The anchor helper will produce a link, so your menu items will output like this:

    <li><a href="controller/action">Link Text</a></li>
    

    Once you create the menu you can style it with CSS like any other menu. In place of the anchor helper you can use any of the other URL helpers like current_url or index_page.

    You're not required to use the URL helpers when creating a menu, so if you have a static menu you could use plain HTML to create it.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥50 汇编语言除法溢出问题
  • ¥65 C++实现删除N个数据列表共有的元素
  • ¥15 Visual Studio问题
  • ¥15 state显示变量是字符串形式,但是仍然红色,无法引用,并显示类型不匹配
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波