代码信号器 - 添加“有效” css类链接,怎么办? [英] Codeigniter--add "active" css class to link, how to?
本文介绍了代码信号器 - 添加“有效” css类链接,怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
将活动类添加到链接中的最快,最简单的方法是什么,因此可以对其进行样式化?我正在CI中开发一个应用程序,我想要一个快速简单的方法来自动执行此操作。
What's the quickest and easiest way to add the "active" class to a link, so it can be styled? I'm developing an app in CI, and I'd like a quick easy way to do this automatically.
jQuery也是一个选项...
jQuery is an option too...
推荐答案
你应该真的使用CodeIgniter URI类来做这个,而不是$ _SERVER ['REQUEST_URI']
You should really be using the CodeIgniter URI Class to do this instead of the $_SERVER['REQUEST_URI']
$ this-> uri-> uri_string()
$this->uri->uri_string()
if ( $this->uri->uri_string() == '/contact' )
^^方法来做事情,由于一些复杂性可能发生与codeigniter的路由功能
^^ that is the preferred way to do things due to some complexities that can happen with codeigniter's routing features
这篇关于代码信号器 - 添加“有效” css类链接,怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文