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

创建并理解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?

图片转代码服务由CSDN问答提供 功能建议

早上好,我是CodeIgniter的新手, 我想创建一个水平菜单,我已经完成了 这与HTML + CSS3,当我点击菜单时,它转到指示的页面,当然,使用HTML,但我想在CodeIgniter中做。 我找到了文档,但我不清楚 https:/ /www.codeigniter.com/user_guide/helpers/url_helper.html 有人帮助我吗?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dporb84480
    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.

    点赞 评论

相关推荐