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 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持