CodeIgniter Forums
[solved]Navigation Menu - loading other pages? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: [solved]Navigation Menu - loading other pages? (/showthread.php?tid=42710)

Pages: 1 2


[solved]Navigation Menu - loading other pages? - El Forum - 06-16-2011

[eluser]brucebat[/eluser]
Hi all,

I have built my template for codeigniter which consists of:

controller
=================
site_controller.php (contains index, blog, submit form, retrieve form, login, logout functions)

template structure
==================
template_view.php
header_view.php
nav_view.php
footer_view.php
widgets_view.php

===================
fillers for template:

home.php
blog.php
submit_data.php
retrieve_data.php
login.php

===================
models
===================

blog_model.php
submit_model.php
retrieve_model.php


---------------------------------------

My question is how do I call my other functions w from my navigation menu on my website.

http://i.imgur.com/Eo9it.jpg

I have tried this but it causes my page to stop displaying

Code:
<a >load->controller('site', $page); ?&gt;">Login</a></li>


I think I have missed out on something but I have searched and with my ignorance of the terminology and dogma of this system; have not been able to find an answer for what I need to do to get this crucial part of my site working.

Perhaps a point in the right direction would be beneficial in my learning of this framework rather than a straight out answer ?

Thankyou for your time Smile!


[solved]Navigation Menu - loading other pages? - El Forum - 06-16-2011

[eluser]InsiteFX[/eluser]
url_helper anchor tag in the CodeIgniter User Guide!

InsiteFX


[solved]Navigation Menu - loading other pages? - El Forum - 06-17-2011

[eluser]brucebat[/eluser]
So if i Wanted to activate a function from a Controller using the anchor for example :

controller = site.php

function = login()

echo anchor('controller/site/login', 'Login', 'title="Login"'); ??

Thanks


[solved]Navigation Menu - loading other pages? - El Forum - 06-17-2011

[eluser]marcogmonteiro[/eluser]
yep, just like that =)


[solved]Navigation Menu - loading other pages? - El Forum - 06-17-2011

[eluser]brucebat[/eluser]
That is not working though it is saying this:

Quote:<h4>A PHP Error was encountered</h4>
<p>Severity: Warning</p>
<p>Message: Division by zero</p>
<p>Filename: includes/nav.php</p>
<p>Line Number: 9</p>
==============================
Quote:<h4>A PHP Error was encountered</h4>
<p>Severity: Notice</p>
<p>Message: Use of undefined constant �Login� - assumed '�Login�'</p>
<p>Filename: includes/nav.php</p>
<p>Line Number: 9</p>

==============================
Quote:<h4>A PHP Error was encountered</h4>
<p>Severity: Notice</p>
<p>Message: Use of undefined constant �controller - assumed '�controller'</p>
<p>Filename: includes/nav.php</p>
<p>Line Number: 9</p>

==============================
Quote:<h4>A PHP Error was encountered</h4>
<p>Severity: Notice</p>
<p>Message: Use of undefined constant site - assumed 'site'</p>
<p>Filename: includes/nav.php</p>
<p>Line Number: 9</p>

====================


Then when I click on the link I get a strange url

Code:
http://localhost/midas/<div style=



[solved]Navigation Menu - loading other pages? - El Forum - 06-17-2011

[eluser]brucebat[/eluser]
This is my nav.php code

Quote:<div id="menu">
<ul>
<div id="menuwrap">
<li class="current_page_item"><a href="#">Home</a></li>
<li><$$href="&lt;?php ?&gt;">About</a></li>
<li><$$href="&lt;?php ?&gt;">Blog</a></li>
<li><$$href="&lt;?php echo anchor(‘controller/site/login’, "‘Login’");?&gt; >" Login </a></li>


&lt;!-- end #menu --&gt;
</div>
</ul>
</div>

**Note I changed the "a" = $$ so that I could post it


[solved]Navigation Menu - loading other pages? - El Forum - 06-17-2011

[eluser]cideveloper[/eluser]
ok here we go

1) do not use the quote tags when submitting code. use the code tags, that way you can put whatever you want.

2) you don't put the anchor helper inside an anchor. The anchor helper builds your anchor.
Code:
<div id="menu">
      <ul>
      <div id="menuwrap">
        <li>&lt;?php echo anchor('site_controller/login', 'Login');?&gt;</li>
      </div>
      </ul>
</div>



[solved]Navigation Menu - loading other pages? - El Forum - 06-17-2011

[eluser]brucebat[/eluser]
Thankyou very much cideveloper, I feel kind of silly now.

To answer why I did not put in code tags as it would not allow me to post my html because I do not have enough privileges yet.

There is one last problem which Is annoying me. There appears to be a set of closing php tags "?&gt;" which are appearing on my page and I can't think where they are coming from.

Here is my validation html to show you

http://validator.w3.org/check?uri=http://midas.herobo.com/&charset;=(detect+automatically)&doctype=Inline&ss=1&group=0&user-agent=W3C_Validator/1.2

I have checked all my includes and main content php files but I cant think where it is coming from?

Any ideas


[solved]Navigation Menu - loading other pages? - El Forum - 06-17-2011

[eluser]marcogmonteiro[/eluser]
that should do it Smile


[solved]Navigation Menu - loading other pages? - El Forum - 06-17-2011

[eluser]cideveloper[/eluser]
The only way you will have an extra "?&gt;" is if you have a double closing tag somewhere. I would check your footer. Also Whats up with your host? why is your site under review.