CodeIgniter Forums
Basic question : how to link using codeigniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Basic question : how to link using codeigniter (/thread-53172.html)



Basic question : how to link using codeigniter - El Forum - 07-13-2012

[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


Basic question : how to link using codeigniter - El Forum - 07-13-2012

[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>



Basic question : how to link using codeigniter - El Forum - 07-13-2012

[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




Basic question : how to link using codeigniter - El Forum - 07-13-2012

[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.


Basic question : how to link using codeigniter - El Forum - 07-13-2012

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

Thanks,

Bill