Note that there are some explanatory texts on larger screens.

plurals
  1. POCodeigniter 2.0.x - Controller subdirectories default controller needs to be in URL
    primarykey
    data
    text
    <p>I recently upgraded a site from CodeIgniter 1.7.x to 2.0.3. About the same time someone in my organization requested we add some pages to the site. Underneath a section. In the old version of the site I used some workarounds in the controller to break up a longer URL. But in version 2 I see that I should be able to use subdirectories in the controllers folder to do it in a more proper way. After looking all over the place I've tried all sorts of routing declarations and fiddled with all sorts of things. Hopefully I'm doing something simple, wrong, or perhaps someone has seen a similar issue stemming from the upgrade. </p> <p>I'm trying to get the URL from something like:</p> <pre><code>/about/locations </code></pre> <p>Which used to work with a controller named about.php. To something more like:</p> <pre><code>/about/social_responsibility/commitment </code></pre> <p>Where <code>about</code> is now a aub-directory.</p> <p>Funny thing is, currently it does sorta work. That second URL displays correctly. However my old pages, that first URL, now do not function... My new structure uses a base.php (default_controller) in the <code>about</code> directory. Thus if I write:</p> <pre><code>/about/base/locations </code></pre> <p>It does work. But I thought the whole routing thing (<code>default controller</code>) and using subdirectories is supposed to clean the URL up. </p> <p>My info is as follows...</p> <p><strong>Current Routing</strong> (it's changed a bunch over the last few hours)</p> <pre><code>$route['default_controller'] = "base"; $route['404_override'] = ''; $route['about'] = "about/base"; </code></pre> <p><strong>Directories and Files</strong> </p> <pre><code>/controllers/about/base.php /controllers/about/social_responsibility.php </code></pre> <p><strong>Chunk of base.php</strong></p> <pre><code>class Base extends MY_Controller { public function __construct() { parent::__construct(); $this-&gt;data['parent'] = "About"; $this-&gt;load-&gt;model('mnav'); } public function index() { } public function locations() { } } </code></pre> <p>I also have a <code>MY_Controller</code> that extends <code>CI_Controller</code>, but all it does is enable FirePHP for me in the development environment. </p> <p>Anyone have any clues? Or need some more info to help? Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload