Image display and routes.php or controller?? |
I am using CodeIgniter 2.2.0 for the first time to create a multilingual site where the home page contains a slide show. I am developing it on my laptop -
Code: localhost/website/ I am using the routes.php file to specify which language function to call to set variables depending on the url with format Code: http://localhost/website/language/page_id/some-page-title Thus Code: http://localhost/website/en/1/Home-Page Routes file therefore has: PHP Code: $route['default_controller'] = "content"; An example of a language function (the en function) in the content controller is: PHP Code: public function en ($page_id) { The get_content function then does everything. The index function of the content controller however looks like this: PHP Code: public function index() { Code: http;//localhost/website/ everything works fine including the slideshow. However, when i go to the url Code: http://localhost/website/en/1/Home-Page The only thing i could think of is the fact that if i just put http;//localhost/website/ then the index function will be called which activates the constructor, but if i put http://localhost/website/en/1/Home-Page then the index and thus constructor are bypassed. However dont know why therefore other things still work but pic slideshow doesn’t. Is this the reason do you think? any solutions? Thanks TOm The thing that is really freaking me out is that the outputted code from both urls (simple root url and url with language components) is EXACTLY the same. The links to images etc are both exactly same and also use base_url() to get around path issues. So confused. How can two identical pieces of html display different results? On a different forum, someone has suggested it has to do with the images not being passed through the routes.php file due to the .htaccess...is this true and can anyone help with what code i need to let this happen as .htaccess is not my strong suit... many thanks Tom
Can you copy the images paths in both cases (which are generated in your browser)?
Its good to use base_url() . '/img/path' for such static files .. Best VPS Hosting : Digital Ocean
(11-12-2014, 02:09 AM)sv3tli0 Wrote: Can you copy the images paths in both cases (which are generated in your browser)? I have always found it better from a maintainability perspective to put the path inside the base_url() function: base_url('/img/path') (11-12-2014, 01:39 AM)discofunk Wrote: Thus I don't know how your program is supposed to work, but I do notice, that you are disposing of anything in the route apart from the number. You are not using $2 which is the (:any) part of the route. Is this a deliberate part of your system or do you need the remainder? |
Welcome Guest, Not a member yet? Register Sign In |