CodeIgniter Forums

Full Version: How do you add a link for the homepage?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]johnnyForums[/eluser]
I have this:
Code:
<div id="menu">
        <ul>
            <li class="current_page_item"><a href="">Homepage</a></li>
            <li><a href="">Add</a></li>
            <li><a href="">Search</a></li>
            <li><a href="">About</a></li>
            <li class="last"><a href="">Contact</a></li>
        </ul>
    </div>

The href="" is replaced by whatever was my last view call. What I want is for homepage to go back to the main website page. How do I do that? I don't know what to put there other than index to call the /mycontroller/index function. I didn't know if that was "the way" it was done.

El Forum

[eluser]garymardell[/eluser]
Code:
<li class="current_page_item"><a href="&lt;?=base_url();?&gt;">Homepage</a></li>

or

Code:
<li class="current_page_item">&lt;?=anchor("", "Homepage");?&gt;</li>

El Forum

[eluser]johnnyForums[/eluser]
[quote author="garymardell" date="1248465670"]
Code:
<li class="current_page_item"><a href="&lt;?=base_url();?&gt;">Homepage</a></li>

or

Code:
<li class="current_page_item">&lt;?=anchor("", "Homepage");?&gt;</li>
[/quote]

The first one put me too far back. It did not put be at the default controller so I must not have something set right. It is http://127.0.0.1/myvirtualdirectory instead of http://127.0.0.1/myvirtualdirectory/mydefaultcontroller.

The second one put me at http://127.0.0.1/myvirtualdirectory/index.php but did not put me at the default controller. I got 404 on both. I put in a simple "index" but I would like to make your way work.

El Forum

[eluser]garymardell[/eluser]
Well you obviously have not setup codeigniter quite right. In the routes.php file have you set the right default controller. and also is your base_url in configs file right.