![]() |
Links and IDs - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Links and IDs (/showthread.php?tid=33875) |
Links and IDs - El Forum - 09-11-2010 [eluser]csabessz47[/eluser] Hy all! I'm fairly newbie to Codeigniter but I like it already. I would like to create links (yes I used anchor() already), but I need something like this: Code: <a href="..." id="XX">YYY</a> So I've trouble with the id parameter. How could I create it? My code now: Code: <?php foreach($menu as $key=>$item): ?> I have 2 arrays: Code: $data["menu"] = array("Main","About me","References","Services","Contact"); And I managed to create this: Code: <li><a href="http://localhost/cs/index.php/cv">About me</a></li> But I need for example: id="cv" How can I create it? Links and IDs - El Forum - 09-11-2010 [eluser]CroNiX[/eluser] Code: anchor($url, $title, $attributes); Code: <a href="http://localhost/cs/index.php/cv" id="cv">About Me</a> Code: anchor('cv', 'About Me', 'id="cv" class="someclass"'); would produce: Code: <a href="http://localhost/cs/index.php/cv" id="cv" class="someclass">About Me</a> Links and IDs - El Forum - 09-11-2010 [eluser]csabessz47[/eluser] Thank you for the answer! I didn't think it was easy like this ![]() Links and IDs - El Forum - 09-11-2010 [eluser]CroNiX[/eluser] No prob. This would convert your arrays the way you want. Code: $data["menu"] = array("Main","About me","References","Services","Contact"); Links and IDs - El Forum - 09-11-2010 [eluser]csabessz47[/eluser] yes i used the same way ![]() and again: i'm a newbie: in the controller i have 2 functions: index, and cv. I'd like to link a CSS file, its in localhost/cs/css/style.css How can I solve this? in the controller: Code: $data["css"] = "../../css/style.css"; Code: <link href="<?=$css?>" rel="stylesheet" type="text/css" /> this works at the following url: Quote:http://localhost/cs/index.php/blog/cvand Quote:http://localhost/cs/index.php/blog/but if i just type Quote:http://localhost/csit doesn't work. Any ideas or how should I solve this? I haven't find any tutorial or description for this. Links and IDs - El Forum - 09-11-2010 [eluser]CroNiX[/eluser] Use an asset manager, like caribiner: http://codeigniter.com/wiki/Carabiner/ Then you have a header view that gets called on every page load. From the controller you can dynamically assign css/js whatever to the head of your document in the header view. Links and IDs - El Forum - 09-14-2010 [eluser]csabessz47[/eluser] I need help again. I downloaded Carabiner, copied the config and library files, but I can't make it work. My css folder is next to the 'system' folder. My controller: Code: function Main() { The problem is that I can't use it. I read the wiki but I don't understand. Should I use Code: $this->carabiner->display('css') Links and IDs - El Forum - 09-15-2010 [eluser]csabessz47[/eluser] okey i solved: in the controller: Code: $data["css"] = base_url()."css/style.css"; in the view: Code: <link rel="stylesheet" type="text/css" href="<?=$css?>" media="screen" /> But i didn't want to use full url. |