CodeIgniter Forums

Full Version: Basic question : how to link using codeigniter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]bill19[/eluser]
Hi everyone,

I am working on assembling a small mainly informational website using twitter bootstrap, and I'm unsure what the best practices are for basic internal linking and navigation with codeigniter as part of the project.

As an example I have the following button:

Code:
<p><a class="btn">Learn more »</a></p>

I want to link to a second page with this button. How can I do this with CI, or should I be using CI at all?

Thank you in advance,

Bill

El Forum

[eluser]CroNiX[/eluser]
I'm not really understanding your question. It would just be a link to whatever page you want them to go to like any other link.

Code:
<p><a class="btn" href="http://yoursite.com/controller/next_url">Learn more »</a></p>
or (CI Way)
Code:
<p>&lt;?php echo anchor('controller/next_url', 'Learn More »', 'class="btn"'); ?&gt;</p>

El Forum

[eluser]bill19[/eluser]
Thanks for answering CroNiX,

For best practices should I have a controller in the mix for each page or just have the pages link directly to each other in areas of the site where I am not using php ( just displaying static informational views ) ?

Thanks,

Bill

El Forum

[eluser]CroNiX[/eluser]
The theory is that if HTML specs change, like adding another attribute or something, you'd only have to update the helper code for anchor() (in this case) and it will fix all of your anchors site-wide, assuming you used the anchor() function for each one. Where if you made them all by hand you have to update them all by hand, which may or may not be trivial depending on the size of your application and how many anchors were used.

El Forum

[eluser]bill19[/eluser]
I will read up on CI's anchor().

Thanks,

Bill