Trouble templating the views |
[eluser]kongfjong[/eluser]
I'm trying to creatre some kind of simple template, to get an understanding of how CodeIgniter works. It's very simple so far and uses the info from the video tutorials on the site. Right now I've got a blog.php file in the controllers folder Code: <?php I've then got a blog_view.php and a comment_view.php file in the view folder blog_view.php Code: <h1><?php echo $heading; ?></h1> comment_view.php Code: <h1><?php echo $heading; ?></h1> Then I've created a subfolder in views, named common, which contains these files footer_view.php Code: </body> header_view.php Code: <html> And last but not least, I've created a template.php file in the view folder, which contains this code Code: <?php Now I've got no trouble accessing http://www.footballground.dk/blog which of course uses the index function of the blog controller. But when I access http://www.footballground.dk/blog/comments/1 which should use the comments function of the blog controller, but instead actually uses the index function also. I might be blind, but can't find the error, so hope you can help me
[eluser]Jaketoolson[/eluser]
something is messing up with your $config['uri_protocol']. Navigating using index.php works: http://www.footballground.dk/index.php/blog/comments/1
[eluser]kongfjong[/eluser]
Wow thanks. It works with both QUERY_STRING and REQUEST_URI respectively Do you think, there's any downside to using one of them instead of AUTO?
[eluser]Jaketoolson[/eluser]
This same problem happened to me actually, at least when I switched to CI 2.0. Previously, using .htaccess, I 'hid' index.php from the URL and set the $config['uri_protocol'] to AUTO as well and everything worked fine. Then when I upgraded to CI 2.0, I didn't change a thing and had the same problem as you above. Then I changed it $config['uri_protocol'] to QUERY_STRING and it worked just fine. I haven't really researched the difference between QUERY_STRING and REQUEST_URI.
|
Welcome Guest, Not a member yet? Register Sign In |