CodeIgniter Forums
extend basic news tutorial - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forum-29.html)
+--- Thread: extend basic news tutorial (/thread-77390.html)



extend basic news tutorial - svennd - 08-25-2020

in https://codeigniter.com/user_guide/tutorial/news_section.html 

One of the views has this code : 
Code:
<p><a href="/news/<?= esc($news_item['slug'], 'url'); ?>">View article</a></p>

Now this works if you followed the tutorial to the letter; but if you had any other way... let's say the lazy WAMP way its a bit of a search to find what is going wrong; (the page links to a 404)

I'm assuming this is the correct way of doing things if you are not in the root directory;

Code:
<p><a href="<?php echo base_url('news/' . esc($news_item['slug'], 'url') ); ?>">View article</a></p>

Can I change this line in the documentation ? (or is this also not the correct way)

It would be great not to force people to only use spark, which is to my humble opinion is fun but not what people are going to use any time soon in production.


RE: extend basic news tutorial - InsiteFX - 08-26-2020

It's a tutorial and it is only meant to show how to do it, nothing is sopping you from doing things your own way..

Yes the above will also work.