Welcome Guest, Not a member yet? Register   Sign In
Problem with anchor() in ul()
#1

[eluser]Unknown[/eluser]
Hi everyone,

For two days I have a problem using ul() method from HTML Helper,
I'm trying to include an anchor in a li

Here is my code :

Code:
<?php
       // Attributes for the ul
        $attributes = array('class' => 'topnav pull-right');
       // Elements in the ul
        $list = array(
            'Create account' => array(
                'li_attributes' => 'class="primary"',
                'contents' => echo anchor('front_squash/connexion','Create account',array('class'=>'glyphicons unlock no-ajaxify')) ,
            )
        );
         // This code works but without css and glyphicons
        //echo anchor('front_squash/connexion','Create account',array('class'=>'glyphicons unlock no-ajaxify'));
        echo ul($list, $attributes);
        ?>

This is the html code I want to traduce with the codeigniter syntax

Code:
<li class="primary"><a href="&lt;?php echo site_url();?&gt;" class="glyphicons user_add no-ajaxify"><i></i> Create account</a></li>

This is what I have on the screen:

anchor('front_squash/connexion','Create account',array('class'=>'glyphicons unlock no-ajaxify'))

Instead of : Create account

This will help you to understand my problem and my code:

http://ellislab.com/codeigniter/user-gui...elper.html
http://ellislab.com/forums/viewthread/110356/#556601

I can't find the right codeigniter's syntax...
Can someone help me pls ?

Thanks
Romain
#2

[eluser]CroNiX[/eluser]
In $list, you are echoing the anchor which will output immediately instead of returning it. Just remove the echo and make sure you have the URL helper loaded.




Theme © iAndrew 2016 - Forum software by © MyBB