CodeIgnigniter Config Question

keith smith klsmith2020 at yahoo.com
Mon Feb 20 09:20:09 MST 2012


That did the job!!  Thanks : $route['(:any)'] = "main";

My Approach is very simple.  There is three types of data.  1) Home page, 2) category pages, and 3) content pages.

So all I need to do is read the URL and determine which it is and pull that content and populate the template.

I will probably add one more layer of functionality.  That would be to check if there is a template specifically for that particular content.  

Pretty simple approach.

Thank you for your help!! 

------------------------

Keith Smith

--- On Sun, 2/19/12, Eric Cope <eric.cope at gmail.com> wrote:

From: Eric Cope <eric.cope at gmail.com>
Subject: Re: CodeIgnigniter Config Question
To: "Main PLUG discussion list" <plug-discuss at lists.plug.phoenix.az.us>
Date: Sunday, February 19, 2012, 11:19 PM

Hey Keith,

You can address this multiple ways. One way is mod_rewrite. Obviously this is outside of CodeIgniter. Another way is to define custom Routes (http://codeigniter.com/user_guide/general/routing.html).  



I personally recommend against one monolithic controller. I've found that if your controller is more than about a page of code, its failing DRY principles, difficult to refactor, difficult to test, etc. This is not always the case, but a decent generalization. Then again, if you can leverage models, libraries, and views, and still only have about a page of controller code, then go for it.



Eric

On Sun, Feb 19, 2012 at 9:58 PM, keith smith <klsmith2020 at yahoo.com> wrote:



Hi,

I'm looking at CodeIgniter.  I would like to change the way it works a little bit.  

URL's will take on this pattern:



MyDomain.tld = is the index

MyDomain.tld/page-name (stand alone page)


MyDomain.tld/cat1/catn (one or more categories) (display the last category)

MyDomain.tld/cat1/catn/article-page  (one or more categories then an article page) (display article)


I would like to read the URL in a main controller.  There would only be one controller.  I would break the URL into its arguments and decide what Model and View to load and display. 

Is it possible to configure CodeIgniter to function this way?



Thanks in advance!

------------------------

Keith Smith
---------------------------------------------------

PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us

To subscribe, unsubscribe, or to change your mail settings:

http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss



-----Inline Attachment Follows-----

---------------------------------------------------
PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20120220/87e71607/attachment.html>


More information about the PLUG-discuss mailing list