OT: CodeIgniter Routing

2012-11-30 Thread keith smith


Hi,

I'm rather new to CodeIgniter.  I'm using version 2.0.3 and am using the 
provided .htaccess code to remove index.php from the URL.  

I'm working on a control panel and would like to set up a controller for each 
table to keep things simple and modular.  (any feedback on a better idea is 
much appreciated)

I was thinking I needed to configure the controllers this way

1) $route['cp/pages/(:any)'] = "cp_pages"; (would contain only controller code 
for managing the pages table.)

2) $route['cp/users/(:any)'] = "cp_users"; (would contain only controller code 
for managing the users table.)

 other table configured with their own control panel.

3) $route['cp/'] = "cp"; (splash page and menu.  If not logged in presents the 
log in form)

/cp/  gives me the splash page. so far so good.

/cp/pages - cp controller - not what I was expecting.  I was wanting the index 
function of the cp_pages controler.

/cp/pages/list/ - takes me to the cp_pages controller / index function

What I would like to configure is:

/cp/ - use cp controller

/cp/pages/ - use the cp_pages controller / index function
/cp/pages/add/ - use the cp_pages controller / add function 
/cp/pages/list - use the cp_pages controller /list function
/cp/pages/list/10 - use the cp_pages controller /list function with segment set 
to 10 as starting point.

If I'm going down the wrong path please let me know.

Thank you!  




Keith Smith---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss

Re: OT: CodeIgniter Routing

2012-11-30 Thread Eric Cope
You can just put your controller "pages" in the controller/cp directory...

Then you don't have to muck with the routes...

Eric


On Fri, Nov 30, 2012 at 9:20 AM, keith smith  wrote:

>
>
> Hi,
>
> I'm rather new to CodeIgniter.  I'm using version 2.0.3 and am using the
> provided .htaccess code to remove index.php from the URL.
>
> I'm working on a control panel and would like to set up a controller for
> each table to keep things simple and modular.  (any feedback on a better
> idea is much appreciated)
>
> I was thinking I needed to configure the controllers this way
>
> 1) $route['cp/pages/(:any)'] = "cp_pages"; (would contain only controller
> code for managing the pages table.)
>
> 2) $route['cp/users/(:any)'] = "cp_users"; (would contain only controller
> code for managing the users table.)
>
>  other table configured with their own control panel.
>
> 3) $route['cp/'] = "cp"; (splash page and menu.  If not logged in presents
> the log in form)
>
> /cp/  gives me the splash page. so far so good.
>
> /cp/pages - cp controller - not what I was expecting.  I was wanting the
> index function of the cp_pages controler.
>
> /cp/pages/list/ - takes me to the cp_pages controller / index function
>
> What I would like to configure is:
>
> /cp/ - use cp controller
>
> /cp/pages/ - use the cp_pages controller / index function
> /cp/pages/add/ - use the cp_pages controller / add function
> /cp/pages/list - use the cp_pages controller /list function
> /cp/pages/list/10 - use the cp_pages controller /list function with
> segment set to 10 as starting point.
>
> If I'm going down the wrong path please let me know.
>
> Thank you!
>
>
> 
> Keith Smith
> ---
> PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss

Re: OT: CodeIgniter Routing

2012-11-30 Thread Tom Haws
Yeah.  Keep researching CodeIgniter tutorials, because ideally, you
wouldn't ever need to use routes.php unless you had a need for an alias or
some other special occasion.

On another note, it would be more conventional to talk to your database
tables in model files and then call model functions in your controllers.
Again, I recall watching a short CodeIgniter tutorial video that really
helped clarify this.

--
"To forgive is the highest, most beautiful form of love. In return, you
will receive untold peace and happiness." - Dr. Robert Muller


On Fri, Nov 30, 2012 at 9:36 AM, Eric Cope  wrote:

> You can just put your controller "pages" in the controller/cp directory...
>
> Then you don't have to muck with the routes...
>
> Eric
>
>
> On Fri, Nov 30, 2012 at 9:20 AM, keith smith wrote:
>
>>
>>
>> Hi,
>>
>> I'm rather new to CodeIgniter.  I'm using version 2.0.3 and am using the
>> provided .htaccess code to remove index.php from the URL.
>>
>> I'm working on a control panel and would like to set up a controller for
>> each table to keep things simple and modular.  (any feedback on a better
>> idea is much appreciated)
>>
>> I was thinking I needed to configure the controllers this way
>>
>> 1) $route['cp/pages/(:any)'] = "cp_pages"; (would contain only controller
>> code for managing the pages table.)
>>
>> 2) $route['cp/users/(:any)'] = "cp_users"; (would contain only controller
>> code for managing the users table.)
>>
>>  other table configured with their own control panel.
>>
>> 3) $route['cp/'] = "cp"; (splash page and menu.  If not logged in
>> presents the log in form)
>>
>> /cp/  gives me the splash page. so far so good.
>>
>> /cp/pages - cp controller - not what I was expecting.  I was wanting the
>> index function of the cp_pages controler.
>>
>> /cp/pages/list/ - takes me to the cp_pages controller / index function
>>
>> What I would like to configure is:
>>
>> /cp/ - use cp controller
>>
>> /cp/pages/ - use the cp_pages controller / index function
>> /cp/pages/add/ - use the cp_pages controller / add function
>> /cp/pages/list - use the cp_pages controller /list function
>> /cp/pages/list/10 - use the cp_pages controller /list function with
>> segment set to 10 as starting point.
>>
>> If I'm going down the wrong path please let me know.
>>
>> Thank you!
>>
>>
>> 
>> Keith Smith
>> ---
>> PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
>> To subscribe, unsubscribe, or to change your mail settings:
>> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>>
>
>
> ---
> PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss

Re: OT: CodeIgniter Routing

2012-11-30 Thread keith smith
Thanks!!

I created a directory under controllers and named it cp.  I moved pages.php 
into that directory.  I left cp.php in the controllers dir.  I also removed all 
the routing definitions from the routes.php file.

Now everything is routed through the cp.php controller.

I must have missed something.  

Thank you for your help!



Keith Smith

--- On Fri, 11/30/12, Eric Cope  wrote:

From: Eric Cope 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 
Date: Friday, November 30, 2012, 9:36 AM

You can just put your controller "pages" in the controller/cp directory...
Then you don't have to muck with the routes...
Eric



On Fri, Nov 30, 2012 at 9:20 AM, keith smith  wrote:




Hi,

I'm rather new to CodeIgniter.  I'm using version 2.0.3 and am using the 
provided .htaccess code to remove index.php from the URL.  



I'm working on a control panel and would like to set up a controller for each 
table to keep things simple and modular.  (any feedback on a better idea is 
much appreciated)

I was thinking I needed to configure the controllers this way



1) $route['cp/pages/(:any)'] = "cp_pages"; (would contain only controller code 
for managing the pages table.)

2) $route['cp/users/(:any)'] = "cp_users"; (would contain only controller code 
for managing the users table.)



 other table configured with their own control panel.

3) $route['cp/'] = "cp"; (splash page and menu.  If not logged in presents the 
log in form)

/cp/  gives me the splash page. so far so
 good.

/cp/pages - cp controller - not what I was expecting.  I was wanting the index 
function of the cp_pages controler.

/cp/pages/list/ - takes me to the cp_pages controller / index function

What I would like to configure is:



/cp/ - use cp controller

/cp/pages/ - use the cp_pages controller / index function
/cp/pages/add/ - use the cp_pages controller / add function 
/cp/pages/list - use the cp_pages controller /list function


/cp/pages/list/10 - use the cp_pages controller /list function with segment set 
to 10 as starting point.

If I'm going down the wrong path please let me know.

Thank you!  






Keith Smith
---

PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org

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

http://lists.phxlinux.org/mailman/listinfo/plug-discuss



-Inline Attachment Follows-

---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss

Re: OT: CodeIgniter Routing

2012-11-30 Thread Amit Nepal
I avoid routes as much as possible. Controller alone can handle various 
functions and you don't really need to create multiple controllers for 
similar task. Helps keep it simple.


eg. if I were to have  CRUD operations on a page, i would create a page 
controller , which would then have various functions like add  , delete, 
update etc and the default (index) function in the controller would list 
stuffs.


For database as Tom metioned, just use the model (eg. page_model.php , 
would have all the functions related to database ) ,  you can then load  
page model in the page controller and do the CRUD operations.


http://tutorialcodeigniter.com/beginners/welcome.html  ( This might be 
helpful too)



*Amit K Nepal
Infrastructure Engineer (RHCE)
omNovia Technologies Inc 
Amit K Nepal 
*
On 11/30/2012 9:53 AM, Tom Haws wrote:
Yeah.  Keep researching CodeIgniter tutorials, because ideally, you 
wouldn't ever need to use routes.php unless you had a need for an 
alias or some other special occasion.


On another note, it would be more conventional to talk to your 
database tables in model files and then call model functions in your 
controllers.  Again, I recall watching a short CodeIgniter tutorial 
video that really helped clarify this.


--
"To forgive is the highest, most beautiful form of love. In return, 
you will receive untold peace and happiness." - Dr. Robert Muller



On Fri, Nov 30, 2012 at 9:36 AM, Eric Cope > wrote:


You can just put your controller "pages" in the controller/cp
directory...

Then you don't have to muck with the routes...

Eric


On Fri, Nov 30, 2012 at 9:20 AM, keith smith
mailto:klsmith2...@yahoo.com>> wrote:



Hi,

I'm rather new to CodeIgniter.  I'm using version 2.0.3 and am
using the provided .htaccess code to remove index.php from the
URL.

I'm working on a control panel and would like to set up a
controller for each table to keep things simple and modular. 
(any feedback on a better idea is much appreciated)


I was thinking I needed to configure the controllers this way

1) $route['cp/pages/(:any)'] = "cp_pages"; (would contain only
controller code for managing the pages table.)

2) $route['cp/users/(:any)'] = "cp_users"; (would contain only
controller code for managing the users table.)

 other table configured with their own control panel.

3) $route['cp/'] = "cp"; (splash page and menu.  If not logged
in presents the log in form)

/cp/  gives me the splash page. so far so good.

/cp/pages - cp controller - not what I was expecting.  I was
wanting the index function of the cp_pages controler.

/cp/pages/list/ - takes me to the cp_pages controller / index
function

What I would like to configure is:

/cp/ - use cp controller

/cp/pages/ - use the cp_pages controller / index function
/cp/pages/add/ - use the cp_pages controller / add function
/cp/pages/list - use the cp_pages controller /list function
/cp/pages/list/10 - use the cp_pages controller /list function
with segment set to 10 as starting point.

If I'm going down the wrong path please let me know.

Thank you!



Keith Smith


---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org

To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss



---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org

To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss




---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss


---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss

Re: OT: CodeIgniter Routing

2012-11-30 Thread keith smith

I want to create separate CRUD controllers for each table.  If I use one 
controller to manage 30 or 40 tables I end up with a controller that would be 
thousands of lines long.  

I am following the M-V-C methodology built into Codeigniter.

I'm trying to figure out how to build the routing so that I can have :

/cp - menu and login

/cp/pages - CRUD controller for the pages table

/cp/users - CRUD controller for the users table

I will need to CRUD 30+ tables.  

Thank you for your help!
   



Keith Smith

--- On Fri, 11/30/12, Amit Nepal  wrote:

From: Amit Nepal 
Subject: Re: OT: CodeIgniter Routing
To: plug-discuss@lists.phxlinux.org
Date: Friday, November 30, 2012, 10:06 AM


  


  
  
I avoid routes as much as possible.
  Controller alone can handle various functions and you don't really
  need to create multiple controllers for similar task. Helps keep
  it simple. 

  

  eg. if I were to have  CRUD operations on a page, i would create a
  page controller , which would then have various functions like
  add  , delete, update etc and the default (index) function in the
  controller would list stuffs.

  

  For database as Tom metioned, just use the model (eg.
  page_model.php , would have all the functions related to database
  ) ,  you can then load  page model in the page controller and do
  the CRUD operations.

  

  http://tutorialcodeigniter.com/beginners/welcome.html  ( This
  might be helpful too)

  

  

  Amit K Nepal

  Infrastructure Engineer (RHCE)

  omNovia Technologies Inc

  Amit K Nepal

  
  On 11/30/2012 9:53 AM, Tom Haws wrote:


Yeah.  Keep researching CodeIgniter tutorials, because
  ideally, you wouldn't ever need to use routes.php unless you had a
  need for an alias or some other special occasion.

  

  On another note, it would be more conventional to talk to your
  database tables in model files and then call model functions in
  your controllers.  Again, I recall watching a short CodeIgniter
  tutorial video that really helped clarify this.

  

--

"To forgive is the highest, most beautiful form of love. In
return, you will receive untold peace and happiness." - Dr.
Robert Muller





On Fri, Nov 30, 2012 at 9:36 AM, Eric
  Cope 
  wrote:

  
You can just put your controller "pages" in the
controller/cp directory...



Then you don't have to muck with the routes...



Eric


  

  

  On Fri, Nov 30, 2012 at 9:20 AM, keith
smith 
wrote:

  


  

  

  


  

  Hi,

  

  I'm rather new to CodeIgniter.  I'm using
  version 2.0.3 and am using the provided
  .htaccess code to remove index.php from
  the URL.  

  

  I'm working on a control panel and would
  like to set up a controller for each table
  to keep things simple and modular.  (any
  feedback on a better idea is much
  appreciated)

  

  I was thinking I needed to configure the
  controllers this way

  

  1) $route['cp/pages/(:any)'] = "cp_pages";
  (would contain only controller code for
  managing the pages table.)

  

  2) $route['cp/users/(:any)'] = "cp_users";
  (would contain only controller code for
  managing the users table.)

  

   other table configured with their own
  control panel.

  

  3) $route['cp/'] = "cp"; (splash page and
  menu.  If not logged in presents the log
  in form)

  

  /cp/  gives me the splash page. so 

Re: OT: CodeIgniter Routing

2012-11-30 Thread keith smith

If I can avoid modifying the routing.php script that would be great.  

I watched both video's that were on the old CI site, read lots of posts on 
Google, and have a book that I read cover to cover.  

I have not found any real in-dept info on CI routing.

Thanks for your help!!  



Keith Smith

--- On Fri, 11/30/12, Tom Haws  wrote:

From: Tom Haws 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 
Date: Friday, November 30, 2012, 9:53 AM

Yeah.  Keep researching CodeIgniter tutorials, because ideally, you wouldn't 
ever need to use routes.php unless you had a need for an alias or some other 
special occasion.

On another note, it would be more conventional to talk to your database tables 
in model files and then call model functions in your controllers.  Again, I 
recall watching a short CodeIgniter tutorial video that really helped clarify 
this.


--
"To forgive is the highest, most beautiful form of love. In return, you will 
receive untold peace and happiness." - Dr. Robert Muller



On Fri, Nov 30, 2012 at 9:36 AM, Eric Cope  wrote:

You can just put your controller "pages" in the controller/cp directory...
Then you don't have to muck with the routes...
Eric




On Fri, Nov 30, 2012 at 9:20 AM, keith smith  wrote:





Hi,

I'm rather new to CodeIgniter.  I'm using version 2.0.3 and am using the 
provided .htaccess code to remove index.php from the URL.  




I'm working on a control panel and would like to set up a controller for each 
table to keep things simple and modular.  (any feedback on a better idea is 
much appreciated)

I was thinking I needed to configure the controllers this way




1) $route['cp/pages/(:any)'] = "cp_pages"; (would contain only controller code 
for managing the pages table.)

2) $route['cp/users/(:any)'] = "cp_users"; (would contain only controller code 
for managing the users table.)




 other table configured with their own control panel.

3) $route['cp/'] = "cp"; (splash page and menu.  If not logged in presents the 
log in form)

/cp/  gives me the splash page. so far so
 good.

/cp/pages - cp controller - not what I was expecting.  I was wanting the index 
function of the cp_pages controler.

/cp/pages/list/ - takes me to the cp_pages controller / index function

What I would like to configure is:




/cp/ - use cp controller

/cp/pages/ - use the cp_pages controller / index function
/cp/pages/add/ - use the cp_pages controller / add function 
/cp/pages/list - use the cp_pages controller /list function



/cp/pages/list/10 - use the cp_pages controller /list function with segment set 
to 10 as starting point.

If I'm going down the wrong path please let me know.

Thank you!  







Keith Smith
---

PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org

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

http://lists.phxlinux.org/mailman/listinfo/plug-discuss



---

PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org

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

http://lists.phxlinux.org/mailman/listinfo/plug-discuss



-Inline Attachment Follows-

---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss

Re: OT: CodeIgniter Routing

2012-11-30 Thread Eric Cope
if you are adding 30+ controllers just for CRUD, think about abstracting
the models into a MY_Model.php core file. Keep it DRY, it makes testing
easier too.

Eric


On Fri, Nov 30, 2012 at 10:33 AM, keith smith  wrote:

>
> If I can avoid modifying the routing.php script that would be great.
>
> I watched both video's that were on the old CI site, read lots of posts on
> Google, and have a book that I read cover to cover.
>
> I have not found any real in-dept info on CI routing.
>
> Thanks for your help!!
>
> 
> Keith Smith
>
> --- On *Fri, 11/30/12, Tom Haws * wrote:
>
>
> From: Tom Haws 
>
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> Date: Friday, November 30, 2012, 9:53 AM
>
>
> Yeah.  Keep researching CodeIgniter tutorials, because ideally, you
> wouldn't ever need to use routes.php unless you had a need for an alias or
> some other special occasion.
>
> On another note, it would be more conventional to talk to your database
> tables in model files and then call model functions in your controllers.
> Again, I recall watching a short CodeIgniter tutorial video that really
> helped clarify this.
>
> --
> "To forgive is the highest, most beautiful form of love. In return, you
> will receive untold peace and happiness." - Dr. Robert Muller
>
>
> On Fri, Nov 30, 2012 at 9:36 AM, Eric Cope 
> http://mc/compose?to=eric.c...@gmail.com>
> > wrote:
>
> You can just put your controller "pages" in the controller/cp directory...
>
> Then you don't have to muck with the routes...
>
> Eric
>
>
> On Fri, Nov 30, 2012 at 9:20 AM, keith smith 
> http://mc/compose?to=klsmith2...@yahoo.com>
> > wrote:
>
>
>
> Hi,
>
> I'm rather new to CodeIgniter.  I'm using version 2.0.3 and am using the
> provided .htaccess code to remove index.php from the URL.
>
> I'm working on a control panel and would like to set up a controller for
> each table to keep things simple and modular.  (any feedback on a better
> idea is much appreciated)
>
> I was thinking I needed to configure the controllers this way
>
> 1) $route['cp/pages/(:any)'] = "cp_pages"; (would contain only controller
> code for managing the pages table.)
>
> 2) $route['cp/users/(:any)'] = "cp_users"; (would contain only controller
> code for managing the users table.)
>
>  other table configured with their own control panel.
>
> 3) $route['cp/'] = "cp"; (splash page and menu.  If not logged in presents
> the log in form)
>
> /cp/  gives me the splash page. so far so good.
>
> /cp/pages - cp controller - not what I was expecting.  I was wanting the
> index function of the cp_pages controler.
>
> /cp/pages/list/ - takes me to the cp_pages controller / index function
>
> What I would like to configure is:
>
> /cp/ - use cp controller
>
> /cp/pages/ - use the cp_pages controller / index function
> /cp/pages/add/ - use the cp_pages controller / add function
> /cp/pages/list - use the cp_pages controller /list function
> /cp/pages/list/10 - use the cp_pages controller /list function with
> segment set to 10 as starting point.
>
> If I'm going down the wrong path please let me know.
>
> Thank you!
>
>
> 
> Keith Smith
> ---
> PLUG-discuss mailing list - 
> PLUG-discuss@lists.phxlinux.org<http://mc/compose?to=PLUG-discuss@lists.phxlinux.org>
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
>
>
> ---
> PLUG-discuss mailing list - 
> PLUG-discuss@lists.phxlinux.org<http://mc/compose?to=PLUG-discuss@lists.phxlinux.org>
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
>
>
> -Inline Attachment Follows-
>
>
> ---
> PLUG-discuss mailing list - 
> PLUG-discuss@lists.phxlinux.org<http://mc/compose?to=PLUG-discuss@lists.phxlinux.org>
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
>
> ---
> PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss

Re: OT: CodeIgniter Routing

2012-11-30 Thread keith smith

Actually I have 50+ tables to deal with.  That number will grow.  I'm not 
following what you are suggesting - "abstracting the models into a MY_Model.php 
core file"?  

I'm thinking one controller for the control panel, and depending on what the 
second segment is (second segment is the table name) then pull in the code for 
managing the one table.  That way I have one controller and 50 includes that 
each contain the CRUD for it's own table.

Any thoughts?

I not finding much in the way of what the CI style of development is.  



Keith Smith

--- On Fri, 11/30/12, Eric Cope  wrote:

From: Eric Cope 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 
Date: Friday, November 30, 2012, 10:47 AM

if you are adding 30+ controllers just for CRUD, think about abstracting the 
models into a MY_Model.php core file. Keep it DRY, it makes testing easier too.
Eric



On Fri, Nov 30, 2012 at 10:33 AM, keith smith  wrote:



If I can avoid modifying the routing.php script that would be great.  

I watched both video's that were on the old CI site, read lots of posts on 
Google, and have a book that I read cover to cover.  



I have not found any real in-dept info on CI routing.

Thanks for your help!!  



Keith Smith

--- On Fri, 11/30/12, Tom Haws  wrote:



From: Tom Haws 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 


Date: Friday, November 30, 2012, 9:53 AM

Yeah.  Keep researching CodeIgniter tutorials, because ideally, you wouldn't 
ever need to use routes.php unless you had a need for an alias or some other 
special occasion.



On another note, it would be more conventional to talk to your database tables 
in model files and then call model functions in your controllers.  Again, I 
recall watching a short CodeIgniter tutorial video that really helped clarify 
this.




--
"To forgive is the highest, most beautiful form of love. In return, you will 
receive untold peace and happiness." - Dr. Robert Muller



On Fri, Nov 30, 2012 at 9:36 AM, Eric Cope  wrote:



You can just put your controller "pages" in the controller/cp directory...
Then you don't have to muck with the routes...
Eric




On Fri, Nov 30, 2012 at 9:20 AM, keith smith  wrote:







Hi,

I'm rather new to CodeIgniter.  I'm using version 2.0.3 and am using the 
provided .htaccess code to remove index.php from the URL.  






I'm working on a control panel and would like to set up a controller for each 
table to keep things simple and modular.  (any feedback on a better idea is 
much appreciated)

I was thinking I needed to configure the controllers this way






1) $route['cp/pages/(:any)'] = "cp_pages"; (would contain only controller code 
for managing the pages table.)

2) $route['cp/users/(:any)'] = "cp_users"; (would contain only controller code 
for managing the users table.)






 other table configured with their own control panel.

3) $route['cp/'] = "cp"; (splash page and menu.  If not logged in presents the 
log in form)

/cp/  gives me the splash page. so far so
 good.

/cp/pages - cp controller - not what I was expecting.  I was wanting the index 
function of the cp_pages controler.

/cp/pages/list/ - takes me to the cp_pages controller / index function

What I would like to configure is:






/cp/ - use cp controller

/cp/pages/ - use the cp_pages controller / index function
/cp/pages/add/ - use the cp_pages controller / add function 
/cp/pages/list - use the cp_pages controller /list function





/cp/pages/list/10 - use the cp_pages controller /list function with segment set 
to 10 as starting point.

If I'm going down the wrong path please let me know.

Thank you!  









Keith Smith
---

PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org

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

http://lists.phxlinux.org/mailman/listinfo/plug-discuss



---

PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org

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

http://lists.phxlinux.org/mailman/listinfo/plug-discuss



-Inline Attachment Follows-

---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org


To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss


---

PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org

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

http://lists.phxlinux.org/mailman/listinfo/plug-discuss



-Inline Attachment Follows-

---
PLUG-discuss ma

Re: OT: CodeIgniter Routing

2012-11-30 Thread Eric Cope
You can do it that way. I always found that the CRUD wasn't just a simple
CRUD. The form validation was slightly different. The data manipulation
between models and views was slightly different.
Therefore, I built individual controllers, with a database table having its
own model extended from MY_Model extended from CI_Model. This allowed me to
put all of the common model functions in one file, test it, then extend it
further for other additional functionality.

The CI style is less about doing it a specific way. Its not like Rails
where there is ONLY one way to do things. CI is flexible.

Does that help?

Eric


On Fri, Nov 30, 2012 at 11:04 AM, keith smith  wrote:

>
> Actually I have 50+ tables to deal with.  That number will grow.  I'm not
> following what you are suggesting - "abstracting the models into a
> MY_Model.php core file"?
>
> I'm thinking one controller for the control panel, and depending on what
> the second segment is (second segment is the table name) then pull in the
> code for managing the one table.  That way I have one controller and 50
> includes that each contain the CRUD for it's own table.
>
> Any thoughts?
>
> I not finding much in the way of what the CI style of development is.
>
> 
> Keith Smith
>
> --- On *Fri, 11/30/12, Eric Cope * wrote:
>
>
> From: Eric Cope 
>
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> Date: Friday, November 30, 2012, 10:47 AM
>
>
> if you are adding 30+ controllers just for CRUD, think about abstracting
> the models into a MY_Model.php core file. Keep it DRY, it makes testing
> easier too.
>
> Eric
>
>
> On Fri, Nov 30, 2012 at 10:33 AM, keith smith 
> http://mc/compose?to=klsmith2...@yahoo.com>
> > wrote:
>
>
> If I can avoid modifying the routing.php script that would be great.
>
> I watched both video's that were on the old CI site, read lots of posts on
> Google, and have a book that I read cover to cover.
>
> I have not found any real in-dept info on CI routing.
>
> Thanks for your help!!
>
> ----
> Keith Smith
>
> --- On *Fri, 11/30/12, Tom Haws 
> http://mc/compose?to=tom.h...@gmail.com>
> >* wrote:
>
>
> From: Tom Haws http://mc/compose?to=tom.h...@gmail.com>
> >
>
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> http://mc/compose?to=plug-discuss@lists.phxlinux.org>
> >
> Date: Friday, November 30, 2012, 9:53 AM
>
>
> Yeah.  Keep researching CodeIgniter tutorials, because ideally, you
> wouldn't ever need to use routes.php unless you had a need for an alias or
> some other special occasion.
>
> On another note, it would be more conventional to talk to your database
> tables in model files and then call model functions in your controllers.
> Again, I recall watching a short CodeIgniter tutorial video that really
> helped clarify this.
>
> --
> "To forgive is the highest, most beautiful form of love. In return, you
> will receive untold peace and happiness." - Dr. Robert Muller
>
>
> On Fri, Nov 30, 2012 at 9:36 AM, Eric Cope 
> http://mc/compose?to=eric.c...@gmail.com>
> > wrote:
>
> You can just put your controller "pages" in the controller/cp directory...
>
> Then you don't have to muck with the routes...
>
> Eric
>
>
> On Fri, Nov 30, 2012 at 9:20 AM, keith smith 
> http://mc/compose?to=klsmith2...@yahoo.com>
> > wrote:
>
>
>
> Hi,
>
> I'm rather new to CodeIgniter.  I'm using version 2.0.3 and am using the
> provided .htaccess code to remove index.php from the URL.
>
> I'm working on a control panel and would like to set up a controller for
> each table to keep things simple and modular.  (any feedback on a better
> idea is much appreciated)
>
> I was thinking I needed to configure the controllers this way
>
> 1) $route['cp/pages/(:any)'] = "cp_pages"; (would contain only controller
> code for managing the pages table.)
>
> 2) $route['cp/users/(:any)'] = "cp_users"; (would contain only controller
> code for managing the users table.)
>
>  other table configured with their own control panel.
>
> 3) $route['cp/'] = "cp"; (splash page and menu.  If not logged in presents
> the log in form)
>
> /cp/  gives me the splash page. so far so good.
>
> /cp/pages - cp controller - not what I was expecting.  I was wanting the
> index function of the cp_pages controler.
>
> /cp/pages/list/ - takes me to the cp_pages controller / index function
>
> What I would like to configure is:

Re: OT: CodeIgniter Routing

2012-11-30 Thread keith smith

Ok,  I understand.  What you are talking about is what I would like to do.  
However When I drop cp.php in the controllers directory and drop pages.php in 
the controllers/cp directory,

/cp/pages uses the cp.php controller.  If this is what you suggested earlier, I 
must have it mis configured.

I appreciate your help!!



Keith Smith

--- On Fri, 11/30/12, Eric Cope  wrote:

From: Eric Cope 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 
Date: Friday, November 30, 2012, 11:12 AM

You can do it that way. I always found that the CRUD wasn't just a simple CRUD. 
The form validation was slightly different. The data manipulation between 
models and views was slightly different. Therefore, I built individual 
controllers, with a database table having its own model extended from MY_Model 
extended from CI_Model. This allowed me to put all of the common model 
functions in one file, test it, then extend it further for other additional 
functionality.


The CI style is less about doing it a specific way. Its not like Rails where 
there is ONLY one way to do things. CI is flexible.
Does that help?
Eric



On Fri, Nov 30, 2012 at 11:04 AM, keith smith  wrote:



Actually I have 50+ tables to deal with.  That number will grow.  I'm not 
following what you are suggesting - "abstracting the models into a MY_Model.php 
core file"?  



I'm thinking one controller for the control panel, and depending on what the 
second segment is (second segment is the table name) then pull in the code for 
managing the one table.  That way I have one controller and 50 includes that 
each contain the CRUD for it's own table.



Any thoughts?

I not finding much in the way of what the CI style of development is.  



Keith Smith

--- On Fri, 11/30/12, Eric Cope  wrote:



From: Eric Cope 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 


Date: Friday, November 30, 2012, 10:47 AM

if you are adding 30+ controllers just for CRUD, think about abstracting the 
models into a MY_Model.php core file. Keep it DRY, it makes testing easier too.


Eric



On Fri, Nov 30, 2012 at 10:33 AM, keith smith  wrote:





If I can avoid modifying the routing.php script that would be great.  

I watched both video's that were on the old CI site, read lots of posts on 
Google, and have a book that I read cover to cover.  





I have not found any real in-dept info on CI routing.

Thanks for your help!!  



Keith Smith

--- On Fri, 11/30/12, Tom Haws  wrote:





From: Tom Haws 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 




Date: Friday, November 30, 2012, 9:53 AM

Yeah.  Keep researching CodeIgniter tutorials, because ideally, you wouldn't 
ever need to use routes.php unless you had a need for an alias or some other 
special occasion.





On another note, it would be more conventional to talk to your database tables 
in model files and then call model functions in your controllers.  Again, I 
recall watching a short CodeIgniter tutorial video that really helped clarify 
this.






--
"To forgive is the highest, most beautiful form of love. In return, you will 
receive untold peace and happiness." - Dr. Robert Muller



On Fri, Nov 30, 2012 at 9:36 AM, Eric Cope  wrote:





You can just put your controller "pages" in the controller/cp directory...
Then you don't have to muck with the routes...
Eric




On Fri, Nov 30, 2012 at 9:20 AM, keith smith  wrote:









Hi,

I'm rather new to CodeIgniter.  I'm using version 2.0.3 and am using the 
provided .htaccess code to remove index.php from the URL.  








I'm working on a control panel and would like to set up a controller for each 
table to keep things simple and modular.  (any feedback on a better idea is 
much appreciated)

I was thinking I needed to configure the controllers this way








1) $route['cp/pages/(:any)'] = "cp_pages"; (would contain only controller code 
for managing the pages table.)

2) $route['cp/users/(:any)'] = "cp_users"; (would contain only controller code 
for managing the users table.)








 other table configured with their own control panel.

3) $route['cp/'] = "cp"; (splash page and menu.  If not logged in presents the 
log in form)

/cp/  gives me the splash page. so far so
 good.

/cp/pages - cp controller - not what I was expecting.  I was wanting the index 
function of the cp_pages controler.

/cp/pages/list/ - takes me to the cp_pages controller / index function

What I would like to configure is:








/cp/ - use cp controller

/cp/pages/ - use the cp_pages controller / index function
/cp/pages/add/ - use the cp_pages controller / add function 
/cp/pages/list - use the cp_pages controller /list function








Re: OT: CodeIgniter Routing

2012-11-30 Thread Tom Haws
Keith,

Remember the MVC motto "Keep models fat.  Keep controllers skinny."
Ideally the controller is nothing but a butler or a receptionist who knows
who does what and where to send you for what.

Here's what would be the standard procedure for the Tempe, Arizona Valley
MedTrans team.

1.  For every cp/, cp/page1, cp/page2, etc, have a function index(),
function page1() function page2(), etc in controllers/cp.php.
2.  For every table (or logical "item" of business) such as article,
user_account, inventory_item, bid, shipment, etc, have a file
models/article_model.php, models/user_account_model.php,
models/inventory_item_model.php, models/bid_model.php,
models/shipment_model.php.
3.  Inside every ___model.php file, have functions like
get_user_account($id), change_user_password($user_id, $new_password),
get_shipments_by_user($user_id).

Is it possible some of your tables might be able to be combined?  Would you
be interested in sharing part of the db schema?

--
"To forgive is the highest, most beautiful form of love. In return, you
will receive untold peace and happiness." - Dr. Robert Muller


On Fri, Nov 30, 2012 at 11:20 AM, keith smith  wrote:

>
> Ok,  I understand.  What you are talking about is what I would like to
> do.  However When I drop cp.php in the controllers directory and drop
> pages.php in the controllers/cp directory,
>
> /cp/pages uses the cp.php controller.  If this is what you suggested
> earlier, I must have it mis configured.
>
> I appreciate your help!!
>
> 
> Keith Smith
>
> --- On *Fri, 11/30/12, Eric Cope * wrote:
>
>
> From: Eric Cope 
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> Date: Friday, November 30, 2012, 11:12 AM
>
>
> You can do it that way. I always found that the CRUD wasn't just a simple
> CRUD. The form validation was slightly different. The data manipulation
> between models and views was slightly different.
> Therefore, I built individual controllers, with a database table having
> its own model extended from MY_Model extended from CI_Model. This allowed
> me to put all of the common model functions in one file, test it, then
> extend it further for other additional functionality.
>
> The CI style is less about doing it a specific way. Its not like Rails
> where there is ONLY one way to do things. CI is flexible.
>
> Does that help?
>
> Eric
>
>
> On Fri, Nov 30, 2012 at 11:04 AM, keith smith 
> http://mc/compose?to=klsmith2...@yahoo.com>
> > wrote:
>
>
> Actually I have 50+ tables to deal with.  That number will grow.  I'm not
> following what you are suggesting - "abstracting the models into a
> MY_Model.php core file"?
>
> I'm thinking one controller for the control panel, and depending on what
> the second segment is (second segment is the table name) then pull in the
> code for managing the one table.  That way I have one controller and 50
> includes that each contain the CRUD for it's own table.
>
> Any thoughts?
>
> I not finding much in the way of what the CI style of development is.
>
> 
> Keith Smith
>
> --- On *Fri, 11/30/12, Eric Cope 
> http://mc/compose?to=eric.c...@gmail.com>
> >* wrote:
>
>
> From: Eric Cope http://mc/compose?to=eric.c...@gmail.com>
> >
>
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> http://mc/compose?to=plug-discuss@lists.phxlinux.org>
> >
> Date: Friday, November 30, 2012, 10:47 AM
>
>
> if you are adding 30+ controllers just for CRUD, think about abstracting
> the models into a MY_Model.php core file. Keep it DRY, it makes testing
> easier too.
>
> Eric
>
>
> On Fri, Nov 30, 2012 at 10:33 AM, keith smith 
> http://mc/compose?to=klsmith2...@yahoo.com>
> > wrote:
>
>
> If I can avoid modifying the routing.php script that would be great.
>
> I watched both video's that were on the old CI site, read lots of posts on
> Google, and have a book that I read cover to cover.
>
> I have not found any real in-dept info on CI routing.
>
> Thanks for your help!!
>
> 
> Keith Smith
>
> --- On *Fri, 11/30/12, Tom Haws 
> http://mc/compose?to=tom.h...@gmail.com>
> >* wrote:
>
>
> From: Tom Haws http://mc/compose?to=tom.h...@gmail.com>
> >
>
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> http://mc/compose?to=plug-discuss@lists.phxlinux.org>
> >
> Date: Friday, November 30, 2012, 9:53 AM
>
>
> Yeah.  Keep researching CodeIgniter tutorials, because ideally, you
> wouldn't ever need to use rout

Re: OT: CodeIgniter Routing

2012-11-30 Thread keith smith

Thank Tom,

I'm already following the M-V-C like you outlined.  The database is normalized 
so no tables can be combined.

For one table the controller contains about 100 lines of code for 
add/edit/delete/save/list.  For 50 tables that would be 5000 lines of code in 
one controller.

If I can figure out the routing, I can create one controller per table.  That 
is the optimum for me.  Otherwise I will use includes with a switch to 
determine what code needs to be included and run.

Thanks again!!





Keith Smith

--- On Fri, 11/30/12, Tom Haws  wrote:

From: Tom Haws 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 
Date: Friday, November 30, 2012, 12:13 PM

Keith, Remember the MVC motto "Keep models fat.  Keep controllers skinny."  
Ideally the controller is nothing but a butler or a receptionist who knows who 
does what and where to send you for what.
 Here's what would be the standard procedure for the Tempe, Arizona Valley 
MedTrans team. 1.  For every cp/, cp/page1, cp/page2, etc, have a function 
index(), function page1() function page2(), etc in controllers/cp.php.
2.  For every table (or logical "item" of business) such as article, 
user_account, inventory_item, bid, shipment, etc, have a file 
models/article_model.php, models/user_account_model.php, 
models/inventory_item_model.php, models/bid_model.php, 
models/shipment_model.php.
3.  Inside every ___model.php file, have functions like 
get_user_account($id), change_user_password($user_id, $new_password), 
get_shipments_by_user($user_id). Is it possible some of your tables might be 
able to be combined?  Would you be interested in sharing part of the db schema?

--
"To forgive is the highest, most beautiful form of love. In return, you will 
receive untold peace and happiness." - Dr. Robert Muller



On Fri, Nov 30, 2012 at 11:20 AM, keith smith  wrote:


Ok,  I understand.  What you are talking about is what I would like to do.  
However When I drop cp.php in the controllers directory and drop pages.php in 
the controllers/cp directory,


/cp/pages uses the cp.php controller.  If this is what you suggested earlier, I 
must have it mis configured.

I appreciate your help!!



Keith Smith

--- On Fri, 11/30/12, Eric Cope  wrote:


From: Eric Cope 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 

Date: Friday, November 30, 2012, 11:12 AM

You can do it that way. I always found that the CRUD wasn't just a simple CRUD. 
The form validation was slightly different. The data manipulation between 
models and views was slightly different. 
Therefore, I built individual controllers, with a database table having its own 
model extended from MY_Model extended from CI_Model. This allowed me to put all 
of the common model functions in one file, test it, then extend it further for 
other additional functionality.



The CI style is less about doing it a specific way. Its not like Rails where 
there is ONLY one way to do things. CI is flexible.
Does that help?
Eric




On Fri, Nov 30, 2012 at 11:04 AM, keith smith  wrote:




Actually I have 50+ tables to deal with.  That number will grow.  I'm not 
following what you are suggesting - "abstracting the models into a MY_Model.php 
core file"?  



I'm thinking one controller for the control panel, and depending on what the 
second segment is (second segment is the table name) then pull in the code for 
managing the one table.  That way I have one controller and 50 includes that 
each contain the CRUD for it's own table.




Any thoughts?

I not finding much in the way of what the CI style of development is.  

----

Keith Smith

--- On Fri, 11/30/12, Eric Cope  wrote:




From: Eric Cope 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 



Date: Friday, November 30, 2012, 10:47 AM

if you are adding 30+ controllers just for CRUD, think about abstracting the 
models into a MY_Model.php core file. Keep it DRY, it makes testing easier too.



Eric



On Fri, Nov 30, 2012 at 10:33 AM, keith smith  wrote:






If I can avoid modifying the routing.php script that would be great.  


I watched both video's that were on the old CI site, read lots of posts on 
Google, and have a book that I read cover to cover.  





I have not found any real in-dept info on CI routing.

Thanks for your help!!  

--------

Keith Smith

--- On Fri, 11/30/12, Tom Haws  wrote:






From: Tom Haws 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 





Date: Friday, November 30, 2012, 9:53 AM

Yeah.  Keep researching CodeIgniter tutorials, because ideally, you wouldn't 
ever need to use routes.php unless you had a need for an alias or some other 
special occasion.






On another note, it would be more conventional to talk to your database 

Re: OT: CodeIgniter Routing

2012-11-30 Thread Tom Haws
Keith,

What I'm maybe not understanding is why you are putting 100 lines of CRUD
into the controllers.  We have all CRUD functions in the models, and we
simply call them in the controller functions, so that they typically are
much shorter than 100 lines.

So what I would expect is 100 model files and one controller file with a
function each for 100 pages, assuming you want to organize it that way.  I
think another way might be to make /cp a module with each cp/page1
cp/page2, etc a controller file with mainly only an index function in it.

Tom
Gilbert

--
"To forgive is the highest, most beautiful form of love. In return, you
will receive untold peace and happiness." - Dr. Robert Muller


On Fri, Nov 30, 2012 at 1:41 PM, keith smith  wrote:

>
> Thank Tom,
>
> I'm already following the M-V-C like you outlined.  The database is
> normalized so no tables can be combined.
>
> For one table the controller contains about 100 lines of code for
> add/edit/delete/save/list.  For 50 tables that would be 5000 lines of code
> in one controller.
>
> If I can figure out the routing, I can create one controller per table.
> That is the optimum for me.  Otherwise I will use includes with a switch to
> determine what code needs to be included and run.
>
> Thanks again!!
>
>
>
>
> 
> Keith Smith
>
> --- On *Fri, 11/30/12, Tom Haws * wrote:
>
>
> From: Tom Haws 
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> Date: Friday, November 30, 2012, 12:13 PM
>
>
> Keith,
>
> Remember the MVC motto "Keep models fat.  Keep controllers skinny."
> Ideally the controller is nothing but a butler or a receptionist who knows
> who does what and where to send you for what.
>
> Here's what would be the standard procedure for the Tempe, Arizona Valley
> MedTrans team.
>
> 1.  For every cp/, cp/page1, cp/page2, etc, have a function index(),
> function page1() function page2(), etc in controllers/cp.php.
> 2.  For every table (or logical "item" of business) such as article,
> user_account, inventory_item, bid, shipment, etc, have a file
> models/article_model.php, models/user_account_model.php,
> models/inventory_item_model.php, models/bid_model.php,
> models/shipment_model.php.
> 3.  Inside every ___model.php file, have functions like
> get_user_account($id), change_user_password($user_id, $new_password),
> get_shipments_by_user($user_id).
>
> Is it possible some of your tables might be able to be combined?  Would
> you be interested in sharing part of the db schema?
>
> --
> "To forgive is the highest, most beautiful form of love. In return, you
> will receive untold peace and happiness." - Dr. Robert Muller
>
>
> On Fri, Nov 30, 2012 at 11:20 AM, keith smith 
> http://mc/compose?to=klsmith2...@yahoo.com>
> > wrote:
>
>
> Ok,  I understand.  What you are talking about is what I would like to
> do.  However When I drop cp.php in the controllers directory and drop
> pages.php in the controllers/cp directory,
>
> /cp/pages uses the cp.php controller.  If this is what you suggested
> earlier, I must have it mis configured.
>
> I appreciate your help!!
>
> 
> Keith Smith
>
> --- On *Fri, 11/30/12, Eric Cope 
> http://mc/compose?to=eric.c...@gmail.com>
> >* wrote:
>
>
> From: Eric Cope http://mc/compose?to=eric.c...@gmail.com>
> >
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> http://mc/compose?to=plug-discuss@lists.phxlinux.org>
> >
> Date: Friday, November 30, 2012, 11:12 AM
>
>
> You can do it that way. I always found that the CRUD wasn't just a simple
> CRUD. The form validation was slightly different. The data manipulation
> between models and views was slightly different.
> Therefore, I built individual controllers, with a database table having
> its own model extended from MY_Model extended from CI_Model. This allowed
> me to put all of the common model functions in one file, test it, then
> extend it further for other additional functionality.
>
> The CI style is less about doing it a specific way. Its not like Rails
> where there is ONLY one way to do things. CI is flexible.
>
> Does that help?
>
> Eric
>
>
> On Fri, Nov 30, 2012 at 11:04 AM, keith smith 
> http://mc/compose?to=klsmith2...@yahoo.com>
> > wrote:
>
>
> Actually I have 50+ tables to deal with.  That number will grow.  I'm not
> following what you are suggesting - "abstracting the models into a
> MY_Model.php core file"?
>
> I'm thinking one controller for the control panel, and depending on what
&

Re: OT: CodeIgniter Routing

2012-11-30 Thread Tom Haws
In other words, wouldn't you have the model functions build the data arrays
the way the views are going to need them, then call that output from the
controllers and send it to the views?

--
"To forgive is the highest, most beautiful form of love. In return, you
will receive untold peace and happiness." - Dr. Robert Muller


On Fri, Nov 30, 2012 at 2:00 PM, Tom Haws  wrote:

> Keith,
>
> What I'm maybe not understanding is why you are putting 100 lines of CRUD
> into the controllers.  We have all CRUD functions in the models, and we
> simply call them in the controller functions, so that they typically are
> much shorter than 100 lines.
>
> So what I would expect is 100 model files and one controller file with a
> function each for 100 pages, assuming you want to organize it that way.  I
> think another way might be to make /cp a module with each cp/page1
> cp/page2, etc a controller file with mainly only an index function in it.
>
> Tom
> Gilbert
>
> --
> "To forgive is the highest, most beautiful form of love. In return, you
> will receive untold peace and happiness." - Dr. Robert Muller
>
>
> On Fri, Nov 30, 2012 at 1:41 PM, keith smith wrote:
>
>>
>> Thank Tom,
>>
>> I'm already following the M-V-C like you outlined.  The database is
>> normalized so no tables can be combined.
>>
>> For one table the controller contains about 100 lines of code for
>> add/edit/delete/save/list.  For 50 tables that would be 5000 lines of code
>> in one controller.
>>
>> If I can figure out the routing, I can create one controller per table.
>> That is the optimum for me.  Otherwise I will use includes with a switch to
>> determine what code needs to be included and run.
>>
>> Thanks again!!
>>
>>
>>
>>
>> 
>> Keith Smith
>>
>> --- On *Fri, 11/30/12, Tom Haws * wrote:
>>
>>
>> From: Tom Haws 
>> Subject: Re: OT: CodeIgniter Routing
>> To: "Main PLUG discussion list" 
>> Date: Friday, November 30, 2012, 12:13 PM
>>
>>
>> Keith,
>>
>> Remember the MVC motto "Keep models fat.  Keep controllers skinny."
>> Ideally the controller is nothing but a butler or a receptionist who knows
>> who does what and where to send you for what.
>>
>> Here's what would be the standard procedure for the Tempe, Arizona Valley
>> MedTrans team.
>>
>> 1.  For every cp/, cp/page1, cp/page2, etc, have a function index(),
>> function page1() function page2(), etc in controllers/cp.php.
>> 2.  For every table (or logical "item" of business) such as article,
>> user_account, inventory_item, bid, shipment, etc, have a file
>> models/article_model.php, models/user_account_model.php,
>> models/inventory_item_model.php, models/bid_model.php,
>> models/shipment_model.php.
>> 3.  Inside every ___model.php file, have functions like
>> get_user_account($id), change_user_password($user_id, $new_password),
>> get_shipments_by_user($user_id).
>>
>> Is it possible some of your tables might be able to be combined?  Would
>> you be interested in sharing part of the db schema?
>>
>> --
>> "To forgive is the highest, most beautiful form of love. In return, you
>> will receive untold peace and happiness." - Dr. Robert Muller
>>
>>
>> On Fri, Nov 30, 2012 at 11:20 AM, keith smith 
>> http://mc/compose?to=klsmith2...@yahoo.com>
>> > wrote:
>>
>>
>> Ok,  I understand.  What you are talking about is what I would like to
>> do.  However When I drop cp.php in the controllers directory and drop
>> pages.php in the controllers/cp directory,
>>
>> /cp/pages uses the cp.php controller.  If this is what you suggested
>> earlier, I must have it mis configured.
>>
>> I appreciate your help!!
>>
>> 
>> Keith Smith
>>
>> --- On *Fri, 11/30/12, Eric Cope 
>> http://mc/compose?to=eric.c...@gmail.com>
>> >* wrote:
>>
>>
>> From: Eric Cope 
>> http://mc/compose?to=eric.c...@gmail.com>
>> >
>> Subject: Re: OT: CodeIgniter Routing
>> To: "Main PLUG discussion list" 
>> http://mc/compose?to=plug-discuss@lists.phxlinux.org>
>> >
>> Date: Friday, November 30, 2012, 11:12 AM
>>
>>
>> You can do it that way. I always found that the CRUD wasn't just a simple
>> CRUD. The form validation was slightly different. The data manipulation
>> between models and views was slightly different.
>> Therefore, I b

Re: OT: CodeIgniter Routing

2012-11-30 Thread Eric Cope
also make sure to XSS clean the table names if you are planning on passing
them in from the URL.

Eric


On Fri, Nov 30, 2012 at 2:07 PM, Tom Haws  wrote:

> In other words, wouldn't you have the model functions build the data
> arrays the way the views are going to need them, then call that output from
> the controllers and send it to the views?
>
> --
> "To forgive is the highest, most beautiful form of love. In return, you
> will receive untold peace and happiness." - Dr. Robert Muller
>
>
> On Fri, Nov 30, 2012 at 2:00 PM, Tom Haws  wrote:
>
>> Keith,
>>
>> What I'm maybe not understanding is why you are putting 100 lines of CRUD
>> into the controllers.  We have all CRUD functions in the models, and we
>> simply call them in the controller functions, so that they typically are
>> much shorter than 100 lines.
>>
>> So what I would expect is 100 model files and one controller file with a
>> function each for 100 pages, assuming you want to organize it that way.  I
>> think another way might be to make /cp a module with each cp/page1
>> cp/page2, etc a controller file with mainly only an index function in it.
>>
>> Tom
>> Gilbert
>>
>> --
>> "To forgive is the highest, most beautiful form of love. In return, you
>> will receive untold peace and happiness." - Dr. Robert Muller
>>
>>
>> On Fri, Nov 30, 2012 at 1:41 PM, keith smith wrote:
>>
>>>
>>> Thank Tom,
>>>
>>> I'm already following the M-V-C like you outlined.  The database is
>>> normalized so no tables can be combined.
>>>
>>> For one table the controller contains about 100 lines of code for
>>> add/edit/delete/save/list.  For 50 tables that would be 5000 lines of code
>>> in one controller.
>>>
>>> If I can figure out the routing, I can create one controller per table.
>>> That is the optimum for me.  Otherwise I will use includes with a switch to
>>> determine what code needs to be included and run.
>>>
>>> Thanks again!!
>>>
>>>
>>>
>>>
>>> 
>>> Keith Smith
>>>
>>> --- On *Fri, 11/30/12, Tom Haws * wrote:
>>>
>>>
>>> From: Tom Haws 
>>> Subject: Re: OT: CodeIgniter Routing
>>> To: "Main PLUG discussion list" 
>>> Date: Friday, November 30, 2012, 12:13 PM
>>>
>>>
>>> Keith,
>>>
>>> Remember the MVC motto "Keep models fat.  Keep controllers skinny."
>>> Ideally the controller is nothing but a butler or a receptionist who knows
>>> who does what and where to send you for what.
>>>
>>> Here's what would be the standard procedure for the Tempe, Arizona
>>> Valley MedTrans team.
>>>
>>> 1.  For every cp/, cp/page1, cp/page2, etc, have a function index(),
>>> function page1() function page2(), etc in controllers/cp.php.
>>> 2.  For every table (or logical "item" of business) such as article,
>>> user_account, inventory_item, bid, shipment, etc, have a file
>>> models/article_model.php, models/user_account_model.php,
>>> models/inventory_item_model.php, models/bid_model.php,
>>> models/shipment_model.php.
>>> 3.  Inside every ___model.php file, have functions like
>>> get_user_account($id), change_user_password($user_id, $new_password),
>>> get_shipments_by_user($user_id).
>>>
>>> Is it possible some of your tables might be able to be combined?  Would
>>> you be interested in sharing part of the db schema?
>>>
>>> --
>>> "To forgive is the highest, most beautiful form of love. In return, you
>>> will receive untold peace and happiness." - Dr. Robert Muller
>>>
>>>
>>> On Fri, Nov 30, 2012 at 11:20 AM, keith smith 
>>> http://mc/compose?to=klsmith2...@yahoo.com>
>>> > wrote:
>>>
>>>
>>> Ok,  I understand.  What you are talking about is what I would like to
>>> do.  However When I drop cp.php in the controllers directory and drop
>>> pages.php in the controllers/cp directory,
>>>
>>> /cp/pages uses the cp.php controller.  If this is what you suggested
>>> earlier, I must have it mis configured.
>>>
>>> I appreciate your help!!
>>>
>>> 
>>> Keith Smith
>>>
>>> --- On *Fri, 11/30/12, Eric Cope 
>>> http://mc/compose?to=eric.c...@gmail.com>
>>> >* wrote:

Re: OT: CodeIgniter Routing

2012-11-30 Thread keith smith

Thanks!!  I'm using the segment and using that value with a switch.  If someone 
monkeys with the URL and there is no match in the switch it falls through to an 
error handler. 





Keith Smith

--- On Fri, 11/30/12, Eric Cope  wrote:

From: Eric Cope 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 
Date: Friday, November 30, 2012, 2:25 PM

also make sure to XSS clean the table names if you are planning on passing them 
in from the URL.
Eric

On Fri, Nov 30, 2012 at 2:07 PM, Tom Haws  wrote:


In other words, wouldn't you have the model functions build the data arrays the 
way the views are going to need them, then call that output from the 
controllers and send it to the views?



--
"To forgive is the highest, most beautiful form of love. In return, you will 
receive untold peace and happiness." - Dr. Robert Muller



On Fri, Nov 30, 2012 at 2:00 PM, Tom Haws  wrote:



Keith, What I'm maybe not understanding is why you are putting 100 lines of 
CRUD into the controllers.  We have all CRUD functions in the models, and we 
simply call them in the controller functions, so that they typically are much 
shorter than 100 lines.



 So what I would expect is 100 model files and one controller file with a 
function each for 100 pages, assuming you want to organize it that way.  I 
think another way might be to make /cp a module with each cp/page1 cp/page2, 
etc a controller file with mainly only an index function in it.  



 TomGilbert
--
"To forgive is the highest, most beautiful form of love. In return, you will 
receive untold peace and happiness." - Dr. Robert Muller







On Fri, Nov 30, 2012 at 1:41 PM, keith smith  wrote:



Thank Tom,

I'm already following the M-V-C like you outlined.  The database is normalized 
so no tables can be combined.





For one table the controller contains about 100 lines of code for 
add/edit/delete/save/list.  For 50 tables that would be 5000 lines of code in 
one controller.

If I can figure out the routing, I can create one controller per table.  That 
is the optimum for me.  Otherwise I will use includes with a switch to 
determine what code needs to be included and run.





Thanks again!!





Keith Smith

--- On Fri, 11/30/12, Tom Haws  wrote:





From: Tom Haws 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 




Date: Friday, November 30, 2012, 12:13 PM

Keith, Remember the MVC motto "Keep models fat.  Keep controllers skinny."  
Ideally the controller is nothing but a butler or a receptionist who knows who 
does what and where to send you for what.




 Here's what would be the standard procedure for the Tempe, Arizona Valley 
MedTrans team. 1.  For every cp/, cp/page1, cp/page2, etc, have a function 
index(), function page1() function page2(), etc in controllers/cp.php.




2.  For every table (or logical "item" of business) such as article, 
user_account, inventory_item, bid, shipment, etc, have a file 
models/article_model.php, models/user_account_model.php, 
models/inventory_item_model.php, models/bid_model.php, 
models/shipment_model.php.




3.  Inside every ___model.php file, have functions like 
get_user_account($id), change_user_password($user_id, $new_password), 
get_shipments_by_user($user_id). Is it possible some of your tables might be 
able to be combined?  Would you be interested in sharing part of the db schema?





--
"To forgive is the highest, most beautiful form of love. In return, you will 
receive untold peace and happiness." - Dr. Robert Muller



On Fri, Nov 30, 2012 at 11:20 AM, keith smith  wrote:






Ok,  I understand.  What you are talking about is what I would like to do.  
However When I drop cp.php in the controllers directory and drop pages.php in 
the controllers/cp directory,






/cp/pages uses the cp.php controller.  If this is what you suggested earlier, I 
must have it mis configured.

I appreciate your help!!

----

Keith Smith

--- On Fri, 11/30/12, Eric Cope  wrote:






From: Eric Cope 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 





Date: Friday, November 30, 2012, 11:12 AM

You can do it that way. I always found that the CRUD wasn't just a simple CRUD. 
The form validation was slightly different. The data manipulation between 
models and views was slightly different. 




Therefore, I built individual controllers, with a database table having its own 
model extended from MY_Model extended from CI_Model. This allowed me to put all 
of the common model functions in one file, test it, then extend it further for 
other additional functionality.







The CI style is less about doing it a specific way. Its not like Rails where 
there is ONLY one way to do things. CI is flexible.
Does that help?
Eric








On Fri, Nov 30, 2012 at 11:04 AM, keith smith  wr

Re: OT: CodeIgniter Routing

2012-11-30 Thread keith smith

So your suggesting the Model process the POST data and everything.  This is 
were the business logic should go?



Keith Smith

--- On Fri, 11/30/12, Tom Haws  wrote:

From: Tom Haws 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 
Date: Friday, November 30, 2012, 2:00 PM

Keith, What I'm maybe not understanding is why you are putting 100 lines of 
CRUD into the controllers.  We have all CRUD functions in the models, and we 
simply call them in the controller functions, so that they typically are much 
shorter than 100 lines.
 So what I would expect is 100 model files and one controller file with a 
function each for 100 pages, assuming you want to organize it that way.  I 
think another way might be to make /cp a module with each cp/page1 cp/page2, 
etc a controller file with mainly only an index function in it.  
 TomGilbert
--
"To forgive is the highest, most beautiful form of love. In return, you will 
receive untold peace and happiness." - Dr. Robert Muller




On Fri, Nov 30, 2012 at 1:41 PM, keith smith  wrote:


Thank Tom,

I'm already following the M-V-C like you outlined.  The database is normalized 
so no tables can be combined.


For one table the controller contains about 100 lines of code for 
add/edit/delete/save/list.  For 50 tables that would be 5000 lines of code in 
one controller.

If I can figure out the routing, I can create one controller per table.  That 
is the optimum for me.  Otherwise I will use includes with a switch to 
determine what code needs to be included and run.


Thanks again!!





Keith Smith

--- On Fri, 11/30/12, Tom Haws  wrote:


From: Tom Haws 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 

Date: Friday, November 30, 2012, 12:13 PM

Keith, Remember the MVC motto "Keep models fat.  Keep controllers skinny."  
Ideally the controller is nothing but a butler or a receptionist who knows who 
does what and where to send you for what.

 Here's what would be the standard procedure for the Tempe, Arizona Valley 
MedTrans team. 1.  For every cp/, cp/page1, cp/page2, etc, have a function 
index(), function page1() function page2(), etc in controllers/cp.php.

2.  For every table (or logical "item" of business) such as article, 
user_account, inventory_item, bid, shipment, etc, have a file 
models/article_model.php, models/user_account_model.php, 
models/inventory_item_model.php, models/bid_model.php, 
models/shipment_model.php.

3.  Inside every ___model.php file, have functions like 
get_user_account($id), change_user_password($user_id, $new_password), 
get_shipments_by_user($user_id). Is it possible some of your tables might be 
able to be combined?  Would you be interested in sharing part of the db schema?


--
"To forgive is the highest, most beautiful form of love. In return, you will 
receive untold peace and happiness." - Dr. Robert Muller



On Fri, Nov 30, 2012 at 11:20 AM, keith smith  wrote:



Ok,  I understand.  What you are talking about is what I would like to do.  
However When I drop cp.php in the controllers directory and drop pages.php in 
the controllers/cp directory,



/cp/pages uses the cp.php controller.  If this is what you suggested earlier, I 
must have it mis configured.

I appreciate your help!!



Keith Smith

--- On Fri, 11/30/12, Eric Cope  wrote:



From: Eric Cope 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 


Date: Friday, November 30, 2012, 11:12 AM

You can do it that way. I always found that the CRUD wasn't just a simple CRUD. 
The form validation was slightly different. The data manipulation between 
models and views was slightly different. 

Therefore, I built individual controllers, with a database table having its own 
model extended from MY_Model extended from CI_Model. This allowed me to put all 
of the common model functions in one file, test it, then extend it further for 
other additional functionality.




The CI style is less about doing it a specific way. Its not like Rails where 
there is ONLY one way to do things. CI is flexible.
Does that help?
Eric





On Fri, Nov 30, 2012 at 11:04 AM, keith smith  wrote:





Actually I have 50+ tables to deal with.  That number will grow.  I'm not 
following what you are suggesting - "abstracting the models into a MY_Model.php 
core file"?  



I'm thinking one controller for the control panel, and depending on what the 
second segment is (second segment is the table name) then pull in the code for 
managing the one table.  That way I have one controller and 50 includes that 
each contain the CRUD for it's own table.





Any thoughts?

I not finding much in the way of what the CI style of development is.  

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

Keith Smith

--- On Fri, 11/30/12, Eric Cope  wrote:





From: Eric Cope 
Subject: Re:

Re: OT: CodeIgniter Routing

2012-11-30 Thread Eric Cope
I usually do logic in the model, unless it might be used across models,
then I use a library.

Eric


On Fri, Nov 30, 2012 at 3:05 PM, keith smith  wrote:

>
> So your suggesting the Model process the POST data and everything.  This
> is were the business logic should go?
>
>
> 
> Keith Smith
>
> --- On *Fri, 11/30/12, Tom Haws * wrote:
>
>
> From: Tom Haws 
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> Date: Friday, November 30, 2012, 2:00 PM
>
>
> Keith,
>
> What I'm maybe not understanding is why you are putting 100 lines of CRUD
> into the controllers.  We have all CRUD functions in the models, and we
> simply call them in the controller functions, so that they typically are
> much shorter than 100 lines.
>
> So what I would expect is 100 model files and one controller file with a
> function each for 100 pages, assuming you want to organize it that way.  I
> think another way might be to make /cp a module with each cp/page1
> cp/page2, etc a controller file with mainly only an index function in it.
>
> Tom
> Gilbert
>
> --
> "To forgive is the highest, most beautiful form of love. In return, you
> will receive untold peace and happiness." - Dr. Robert Muller
>
>
> On Fri, Nov 30, 2012 at 1:41 PM, keith smith 
> http://mc/compose?to=klsmith2...@yahoo.com>
> > wrote:
>
>
> Thank Tom,
>
> I'm already following the M-V-C like you outlined.  The database is
> normalized so no tables can be combined.
>
> For one table the controller contains about 100 lines of code for
> add/edit/delete/save/list.  For 50 tables that would be 5000 lines of code
> in one controller.
>
> If I can figure out the routing, I can create one controller per table.
> That is the optimum for me.  Otherwise I will use includes with a switch to
> determine what code needs to be included and run.
>
> Thanks again!!
>
>
>
>
> ----
> Keith Smith
>
> --- On *Fri, 11/30/12, Tom Haws 
> http://mc/compose?to=tom.h...@gmail.com>
> >* wrote:
>
>
> From: Tom Haws http://mc/compose?to=tom.h...@gmail.com>
> >
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> http://mc/compose?to=plug-discuss@lists.phxlinux.org>
> >
> Date: Friday, November 30, 2012, 12:13 PM
>
>
> Keith,
>
> Remember the MVC motto "Keep models fat.  Keep controllers skinny."
> Ideally the controller is nothing but a butler or a receptionist who knows
> who does what and where to send you for what.
>
> Here's what would be the standard procedure for the Tempe, Arizona Valley
> MedTrans team.
>
> 1.  For every cp/, cp/page1, cp/page2, etc, have a function index(),
> function page1() function page2(), etc in controllers/cp.php.
> 2.  For every table (or logical "item" of business) such as article,
> user_account, inventory_item, bid, shipment, etc, have a file
> models/article_model.php, models/user_account_model.php,
> models/inventory_item_model.php, models/bid_model.php,
> models/shipment_model.php.
> 3.  Inside every ___model.php file, have functions like
> get_user_account($id), change_user_password($user_id, $new_password),
> get_shipments_by_user($user_id).
>
> Is it possible some of your tables might be able to be combined?  Would
> you be interested in sharing part of the db schema?
>
> --
> "To forgive is the highest, most beautiful form of love. In return, you
> will receive untold peace and happiness." - Dr. Robert Muller
>
>
> On Fri, Nov 30, 2012 at 11:20 AM, keith smith 
> http://mc/compose?to=klsmith2...@yahoo.com>
> > wrote:
>
>
> Ok,  I understand.  What you are talking about is what I would like to
> do.  However When I drop cp.php in the controllers directory and drop
> pages.php in the controllers/cp directory,
>
> /cp/pages uses the cp.php controller.  If this is what you suggested
> earlier, I must have it mis configured.
>
> I appreciate your help!!
>
> 
> Keith Smith
>
> --- On *Fri, 11/30/12, Eric Cope 
> http://mc/compose?to=eric.c...@gmail.com>
> >* wrote:
>
>
> From: Eric Cope http://mc/compose?to=eric.c...@gmail.com>
> >
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> http://mc/compose?to=plug-discuss@lists.phxlinux.org>
> >
> Date: Friday, November 30, 2012, 11:12 AM
>
>
> You can do it that way. I always found that the CRUD wasn't just a simple
> CRUD. The form validation was slightly different. The data manipulation
> between models and views was sligh

Re: OT: CodeIgniter Routing

2012-11-30 Thread keith smith

Ok,  That would thin the Controller a lot.  Maybe reduce it by 80%  

Thanks! 



Keith Smith

--- On Fri, 11/30/12, Eric Cope  wrote:

From: Eric Cope 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 
Date: Friday, November 30, 2012, 3:16 PM

I usually do logic in the model, unless it might be used across models, then I 
use a library.
Eric

On Fri, Nov 30, 2012 at 3:05 PM, keith smith  wrote:



So your suggesting the Model process the POST data and everything.  This is 
were the business logic should go?





Keith Smith

--- On Fri, 11/30/12, Tom Haws  wrote:



From: Tom Haws 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 


Date: Friday, November 30, 2012, 2:00 PM

Keith, What I'm maybe not understanding is why you are putting 100 lines of 
CRUD into the controllers.  We have all CRUD functions in the models, and we 
simply call them in the controller functions, so that they typically are much 
shorter than 100 lines.


 So what I would expect is 100 model files and one controller file with a 
function each for 100 pages, assuming you want to organize it that way.  I 
think another way might be to make /cp a module with each cp/page1 cp/page2, 
etc a controller file with mainly only an index function in it.  


 TomGilbert
--
"To forgive is the highest, most beautiful form of love. In return, you will 
receive untold peace and happiness." - Dr. Robert Muller




On Fri, Nov 30, 2012 at 1:41 PM, keith smith  wrote:




Thank Tom,

I'm already following the M-V-C like you outlined.  The database is normalized 
so no tables can be combined.




For one table the controller contains about 100 lines of code for 
add/edit/delete/save/list.  For 50 tables that would be 5000 lines of code in 
one controller.

If I can figure out the routing, I can create one controller per table.  That 
is the optimum for me.  Otherwise I will use includes with a switch to 
determine what code needs to be included and run.




Thanks again!!





Keith Smith

--- On Fri, 11/30/12, Tom Haws  wrote:




From: Tom Haws 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 



Date: Friday, November 30, 2012, 12:13 PM

Keith, Remember the MVC motto "Keep models fat.  Keep controllers skinny."  
Ideally the controller is nothing but a butler or a receptionist who knows who 
does what and where to send you for what.



 Here's what would be the standard procedure for the Tempe, Arizona Valley 
MedTrans team. 1.  For every cp/, cp/page1, cp/page2, etc, have a function 
index(), function page1() function page2(), etc in controllers/cp.php.



2.  For every table (or logical "item" of business) such as article, 
user_account, inventory_item, bid, shipment, etc, have a file 
models/article_model.php, models/user_account_model.php, 
models/inventory_item_model.php, models/bid_model.php, 
models/shipment_model.php.



3.  Inside every ___model.php file, have functions like 
get_user_account($id), change_user_password($user_id, $new_password), 
get_shipments_by_user($user_id). Is it possible some of your tables might be 
able to be combined?  Would you be interested in sharing part of the db schema?




--
"To forgive is the highest, most beautiful form of love. In return, you will 
receive untold peace and happiness." - Dr. Robert Muller



On Fri, Nov 30, 2012 at 11:20 AM, keith smith  wrote:





Ok,  I understand.  What you are talking about is what I would like to do.  
However When I drop cp.php in the controllers directory and drop pages.php in 
the controllers/cp directory,





/cp/pages uses the cp.php controller.  If this is what you suggested earlier, I 
must have it mis configured.

I appreciate your help!!



Keith Smith

--- On Fri, 11/30/12, Eric Cope  wrote:





From: Eric Cope 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 




Date: Friday, November 30, 2012, 11:12 AM

You can do it that way. I always found that the CRUD wasn't just a simple CRUD. 
The form validation was slightly different. The data manipulation between 
models and views was slightly different. 



Therefore, I built individual controllers, with a database table having its own 
model extended from MY_Model extended from CI_Model. This allowed me to put all 
of the common model functions in one file, test it, then extend it further for 
other additional functionality.






The CI style is less about doing it a specific way. Its not like Rails where 
there is ONLY one way to do things. CI is flexible.
Does that help?
Eric







On Fri, Nov 30, 2012 at 11:04 AM, keith smith  wrote:







Actually I have 50+ tables to deal with.  That number will grow.  I'm not 
following what you are suggesting - "abstracting the models into a MY_Model.php 
core file"?  

Re: OT: CodeIgniter Routing

2012-11-30 Thread Eric Cope
The rule of thumb I try and follow is to keep the controller to no longer
than a single screen (no scrolling).

Eric


On Fri, Nov 30, 2012 at 3:23 PM, keith smith  wrote:

>
> Ok,  That would thin the Controller a lot.  Maybe reduce it by 80%
>
> Thanks!
>
> 
> Keith Smith
>
> --- On *Fri, 11/30/12, Eric Cope * wrote:
>
>
> From: Eric Cope 
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> Date: Friday, November 30, 2012, 3:16 PM
>
>
> I usually do logic in the model, unless it might be used across models,
> then I use a library.
>
> Eric
>
>
> On Fri, Nov 30, 2012 at 3:05 PM, keith smith 
> http://mc/compose?to=klsmith2...@yahoo.com>
> > wrote:
>
>
> So your suggesting the Model process the POST data and everything.  This
> is were the business logic should go?
>
>
> 
> Keith Smith
>
> --- On *Fri, 11/30/12, Tom Haws 
> http://mc/compose?to=tom.h...@gmail.com>
> >* wrote:
>
>
> From: Tom Haws http://mc/compose?to=tom.h...@gmail.com>
> >
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> http://mc/compose?to=plug-discuss@lists.phxlinux.org>
> >
> Date: Friday, November 30, 2012, 2:00 PM
>
>
> Keith,
>
> What I'm maybe not understanding is why you are putting 100 lines of CRUD
> into the controllers.  We have all CRUD functions in the models, and we
> simply call them in the controller functions, so that they typically are
> much shorter than 100 lines.
>
> So what I would expect is 100 model files and one controller file with a
> function each for 100 pages, assuming you want to organize it that way.  I
> think another way might be to make /cp a module with each cp/page1
> cp/page2, etc a controller file with mainly only an index function in it.
>
> Tom
> Gilbert
>
> --
> "To forgive is the highest, most beautiful form of love. In return, you
> will receive untold peace and happiness." - Dr. Robert Muller
>
>
> On Fri, Nov 30, 2012 at 1:41 PM, keith smith 
> http://mc/compose?to=klsmith2...@yahoo.com>
> > wrote:
>
>
> Thank Tom,
>
> I'm already following the M-V-C like you outlined.  The database is
> normalized so no tables can be combined.
>
> For one table the controller contains about 100 lines of code for
> add/edit/delete/save/list.  For 50 tables that would be 5000 lines of code
> in one controller.
>
> If I can figure out the routing, I can create one controller per table.
> That is the optimum for me.  Otherwise I will use includes with a switch to
> determine what code needs to be included and run.
>
> Thanks again!!
>
>
>
>
> 
> Keith Smith
>
> --- On *Fri, 11/30/12, Tom Haws 
> http://mc/compose?to=tom.h...@gmail.com>
> >* wrote:
>
>
> From: Tom Haws http://mc/compose?to=tom.h...@gmail.com>
> >
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> http://mc/compose?to=plug-discuss@lists.phxlinux.org>
> >
> Date: Friday, November 30, 2012, 12:13 PM
>
>
> Keith,
>
> Remember the MVC motto "Keep models fat.  Keep controllers skinny."
> Ideally the controller is nothing but a butler or a receptionist who knows
> who does what and where to send you for what.
>
> Here's what would be the standard procedure for the Tempe, Arizona Valley
> MedTrans team.
>
> 1.  For every cp/, cp/page1, cp/page2, etc, have a function index(),
> function page1() function page2(), etc in controllers/cp.php.
> 2.  For every table (or logical "item" of business) such as article,
> user_account, inventory_item, bid, shipment, etc, have a file
> models/article_model.php, models/user_account_model.php,
> models/inventory_item_model.php, models/bid_model.php,
> models/shipment_model.php.
> 3.  Inside every ___model.php file, have functions like
> get_user_account($id), change_user_password($user_id, $new_password),
> get_shipments_by_user($user_id).
>
> Is it possible some of your tables might be able to be combined?  Would
> you be interested in sharing part of the db schema?
>
> --
> "To forgive is the highest, most beautiful form of love. In return, you
> will receive untold peace and happiness." - Dr. Robert Muller
>
>
> On Fri, Nov 30, 2012 at 11:20 AM, keith smith 
> http://mc/compose?to=klsmith2...@yahoo.com>
> > wrote:
>
>
> Ok,  I understand.  What you are talking about is what I would like to
> do.  However When I drop cp.php in the controllers directory and drop
> pages.php in the controllers/cp director

Re: OT: CodeIgniter Routing

2012-11-30 Thread keith smith



I think I will have more than one screen unless I can split each table into 
it's own controller.

You and Thomas have helped!!  Thank you both!




Keith Smith

--- On Fri, 11/30/12, Eric Cope  wrote:

From: Eric Cope 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 
Date: Friday, November 30, 2012, 3:26 PM

The rule of thumb I try and follow is to keep the controller to no longer than 
a single screen (no scrolling).
Eric

On Fri, Nov 30, 2012 at 3:23 PM, keith smith  wrote:



Ok,  That would thin the Controller a lot.  Maybe reduce it by 80%  



Thanks! 



Keith Smith

--- On Fri, 11/30/12, Eric Cope  wrote:



From: Eric Cope 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 


Date: Friday, November 30, 2012, 3:16 PM

I usually do logic in the model, unless it might be used across models, then I 
use a library.
Eric



On Fri, Nov 30, 2012 at 3:05 PM, keith smith  wrote:



So your suggesting the Model process the POST data and everything.  This is 
were the business logic should go?







Keith Smith

--- On Fri, 11/30/12, Tom Haws  wrote:





From: Tom Haws 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 




Date: Friday, November 30, 2012, 2:00 PM

Keith, What I'm maybe not understanding is why you are putting 100 lines of 
CRUD into the controllers.  We have all CRUD functions in the models, and we 
simply call them in the controller functions, so that they typically are much 
shorter than 100 lines.




 So what I would expect is 100 model files and one controller file with a 
function each for 100 pages, assuming you want to organize it that way.  I 
think another way might be to make /cp a module with each cp/page1 cp/page2, 
etc a controller file with mainly only an index function in it.  




 TomGilbert
--
"To forgive is the highest, most beautiful form of love. In return, you will 
receive untold peace and happiness." - Dr. Robert Muller




On Fri, Nov 30, 2012 at 1:41 PM, keith smith  wrote:






Thank Tom,

I'm already following the M-V-C like you outlined.  The database is normalized 
so no tables can be combined.






For one table the controller contains about 100 lines of code for 
add/edit/delete/save/list.  For 50 tables that would be 5000 lines of code in 
one controller.

If I can figure out the routing, I can create one controller per table.  That 
is the optimum for me.  Otherwise I will use includes with a switch to 
determine what code needs to be included and run.






Thanks again!!





Keith Smith

--- On Fri, 11/30/12, Tom Haws  wrote:






From: Tom Haws 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 





Date: Friday, November 30, 2012, 12:13 PM

Keith, Remember the MVC motto "Keep models fat.  Keep controllers skinny."  
Ideally the controller is nothing but a butler or a receptionist who knows who 
does what and where to send you for what.





 Here's what would be the standard procedure for the Tempe, Arizona Valley 
MedTrans team. 1.  For every cp/, cp/page1, cp/page2, etc, have a function 
index(), function page1() function page2(), etc in controllers/cp.php.





2.  For every table (or logical "item" of business) such as article, 
user_account, inventory_item, bid, shipment, etc, have a file 
models/article_model.php, models/user_account_model.php, 
models/inventory_item_model.php, models/bid_model.php, 
models/shipment_model.php.





3.  Inside every ___model.php file, have functions like 
get_user_account($id), change_user_password($user_id, $new_password), 
get_shipments_by_user($user_id). Is it possible some of your tables might be 
able to be combined?  Would you be interested in sharing part of the db schema?






--
"To forgive is the highest, most beautiful form of love. In return, you will 
receive untold peace and happiness." - Dr. Robert Muller



On Fri, Nov 30, 2012 at 11:20 AM, keith smith  wrote:







Ok,  I understand.  What you are talking about is what I would like to do.  
However When I drop cp.php in the controllers directory and drop pages.php in 
the controllers/cp directory,







/cp/pages uses the cp.php controller.  If this is what you suggested earlier, I 
must have it mis configured.

I appreciate your help!!

----

Keith Smith

--- On Fri, 11/30/12, Eric Cope  wrote:







From: Eric Cope 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 






Date: Friday, November 30, 2012, 11:12 AM

You can do it that way. I always found that the CRUD wasn't just a simple CRUD. 
The form validation was slightly different. The data manipulation between 
models and views was slightly different. 





Therefore, I built individual controllers, with a database table having its own 
model e

Re: OT: CodeIgniter Routing

2012-11-30 Thread Tom Haws
Totally.  So the controller tries to do nothing more than pass POST
variables to the model functions and pass result arrays to the views.

> 
>
> --- On *Fri, 11/30/12, Eric Cope 
> http://mc/compose?to=eric.c...@gmail.com>
> >* wrote:
>
>
> From: Eric Cope http://mc/compose?to=eric.c...@gmail.com>
> >
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> http://mc/compose?to=plug-discuss@lists.phxlinux.org>
> >
> Date: Friday, November 30, 2012, 3:16 PM
>
>
> I usually do logic in the model, unless it might be used across models,
> then I use a library.
>
> Eric
>
>
> On Fri, Nov 30, 2012 at 3:05 PM, keith smith 
> http://mc/compose?to=klsmith2...@yahoo.com>
> > wrote:
>
>
> So your suggesting the Model process the POST data and everything.  This
> is were the business logic should go?
>
>
> 
> Keith Smith
>
> --- On *Fri, 11/30/12, Tom Haws 
> http://mc/compose?to=tom.h...@gmail.com>
> >* wrote:
>
>
> From: Tom Haws http://mc/compose?to=tom.h...@gmail.com>
> >
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> http://mc/compose?to=plug-discuss@lists.phxlinux.org>
> >
> Date: Friday, November 30, 2012, 2:00 PM
>
>
> Keith,
>
> What I'm maybe not understanding is why you are putting 100 lines of CRUD
> into the controllers.  We have all CRUD functions in the models, and we
> simply call them in the controller functions, so that they typically are
> much shorter than 100 lines.
>
> So what I would expect is 100 model files and one controller file with a
> function each for 100 pages, assuming you want to organize it that way.  I
> think another way might be to make /cp a module with each cp/page1
> cp/page2, etc a controller file with mainly only an index function in it.
>
> Tom
> Gilbert
>
> --
> "To forgive is the highest, most beautiful form of love. In return, you
> will receive untold peace and happiness." - Dr. Robert Muller
>
>
> On Fri, Nov 30, 2012 at 1:41 PM, keith smith 
> http://mc/compose?to=klsmith2...@yahoo.com>
> > wrote:
>
>
> Thank Tom,
>
> I'm already following the M-V-C like you outlined.  The database is
> normalized so no tables can be combined.
>
> For one table the controller contains about 100 lines of code for
> add/edit/delete/save/list.  For 50 tables that would be 5000 lines of code
> in one controller.
>
> If I can figure out the routing, I can create one controller per table.
> That is the optimum for me.  Otherwise I will use includes with a switch to
> determine what code needs to be included and run.
>
> Thanks again!!
>
>
>
>
> 
> Keith Smith
>
> --- On *Fri, 11/30/12, Tom Haws 
> http://mc/compose?to=tom.h...@gmail.com>
> >* wrote:
>
>
> From: Tom Haws http://mc/compose?to=tom.h...@gmail.com>
> >
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> http://mc/compose?to=plug-discuss@lists.phxlinux.org>
> >
> Date: Friday, November 30, 2012, 12:13 PM
>
>
> Keith,
>
> Remember the MVC motto "Keep models fat.  Keep controllers skinny."
> Ideally the controller is nothing but a butler or a receptionist who knows
> who does what and where to send you for what.
>
> Here's what would be the standard procedure for the Tempe, Arizona Valley
> MedTrans team.
>
> 1.  For every cp/, cp/page1, cp/page2, etc, have a function index(),
> function page1() function page2(), etc in controllers/cp.php.
> 2.  For every table (or logical "item" of business) such as article,
> user_account, inventory_item, bid, shipment, etc, have a file
> models/article_model.php, models/user_account_model.php,
> models/inventory_item_model.php, models/bid_model.php,
> models/shipment_model.php.
> 3.  Inside every ___model.php file, have functions like
> get_user_account($id), change_user_password($user_id, $new_password),
> get_shipments_by_user($user_id).
>
> Is it possible some of your tables might be able to be combined?  Would
> you be interested in sharing part of the db schema?
>
> --
> "To forgive is the highest, most beautiful form of love. In return, you
> will receive untold peace and happiness." - Dr. Robert Muller
>
>
> On Fri, Nov 30, 2012 at 11:20 AM, keith smith 
> http://mc/compose?to=klsmith2...@yahoo.com>
> > wrote:
>
>
> Ok,  I understand.  What you are talking about is what I would like to
> do.  However When I drop cp.php in the controllers directory and drop
> pages.php in the controllers/c

Re: OT: CodeIgniter Routing

2012-11-30 Thread keith smith

I'll clean up my code and show it to you.  It is not as short as you say it 
should be.  



Keith Smith

--- On Fri, 11/30/12, Tom Haws  wrote:

From: Tom Haws 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 
Date: Friday, November 30, 2012, 4:14 PM

Totally.  So the controller tries to do nothing more than pass POST variables 
to the model functions and pass result arrays to the views. 


--- On Fri, 11/30/12, Eric Cope  wrote:




From: Eric Cope 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 



Date: Friday, November 30, 2012, 3:16 PM

I usually do logic in the model, unless it might be used across models, then I 
use a library.
Eric



On Fri, Nov 30, 2012 at 3:05 PM, keith smith  wrote:



So your suggesting the Model process the POST data and everything.  This is 
were the business logic should go?








Keith Smith

--- On Fri, 11/30/12, Tom Haws  wrote:






From: Tom Haws 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 





Date: Friday, November 30, 2012, 2:00 PM

Keith, What I'm maybe not understanding is why you are putting 100 lines of 
CRUD into the controllers.  We have all CRUD functions in the models, and we 
simply call them in the controller functions, so that they typically are much 
shorter than 100 lines.





 So what I would expect is 100 model files and one controller file with a 
function each for 100 pages, assuming you want to organize it that way.  I 
think another way might be to make /cp a module with each cp/page1 cp/page2, 
etc a controller file with mainly only an index function in it.  





 TomGilbert
--
"To forgive is the highest, most beautiful form of love. In return, you will 
receive untold peace and happiness." - Dr. Robert Muller




On Fri, Nov 30, 2012 at 1:41 PM, keith smith  wrote:







Thank Tom,

I'm already following the M-V-C like you outlined.  The database is normalized 
so no tables can be combined.







For one table the controller contains about 100 lines of code for 
add/edit/delete/save/list.  For 50 tables that would be 5000 lines of code in 
one controller.

If I can figure out the routing, I can create one controller per table.  That 
is the optimum for me.  Otherwise I will use includes with a switch to 
determine what code needs to be included and run.







Thanks again!!





Keith Smith

--- On Fri, 11/30/12, Tom Haws  wrote:







From: Tom Haws 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 






Date: Friday, November 30, 2012, 12:13 PM

Keith, Remember the MVC motto "Keep models fat.  Keep controllers skinny."  
Ideally the controller is nothing but a butler or a receptionist who knows who 
does what and where to send you for what.






 Here's what would be the standard procedure for the Tempe, Arizona Valley 
MedTrans team. 1.  For every cp/, cp/page1, cp/page2, etc, have a function 
index(), function page1() function page2(), etc in controllers/cp.php.






2.  For every table (or logical "item" of business) such as article, 
user_account, inventory_item, bid, shipment, etc, have a file 
models/article_model.php, models/user_account_model.php, 
models/inventory_item_model.php, models/bid_model.php, 
models/shipment_model.php.






3.  Inside every ___model.php file, have functions like 
get_user_account($id), change_user_password($user_id, $new_password), 
get_shipments_by_user($user_id). Is it possible some of your tables might be 
able to be combined?  Would you be interested in sharing part of the db schema?







--
"To forgive is the highest, most beautiful form of love. In return, you will 
receive untold peace and happiness." - Dr. Robert Muller



On Fri, Nov 30, 2012 at 11:20 AM, keith smith  wrote:








Ok,  I understand.  What you are talking about is what I would like to do.  
However When I drop cp.php in the controllers directory and drop pages.php in 
the controllers/cp directory,








/cp/pages uses the cp.php controller.  If this is what you suggested earlier, I 
must have it mis configured.

I appreciate your help!!

--------

Keith Smith

--- On Fri, 11/30/12, Eric Cope  wrote:








From: Eric Cope 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 







Date: Friday, November 30, 2012, 11:12 AM

You can do it that way. I always found that the CRUD wasn't just a simple CRUD. 
The form validation was slightly different. The data manipulation between 
models and views was slightly different. 






Therefore, I built individual controllers, with a database table having its own 
model extended from MY_Model extended from CI_Model. This allowed me to put all 
of the common model functions in one file, test it, then extend it further for 
other additional functionality.









T

Re: OT: CodeIgniter Routing

2012-11-30 Thread Eric Cope
Keith,
Those are just guidelines. The most important things are:

1) it works
2) its maintainable

Everything else is bonus points :)

Eric


On Fri, Nov 30, 2012 at 7:25 PM, keith smith  wrote:

>
> I'll clean up my code and show it to you.  It is not as short as you say
> it should be.
>
> 
> Keith Smith
>
> --- On *Fri, 11/30/12, Tom Haws * wrote:
>
>
> From: Tom Haws 
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> Date: Friday, November 30, 2012, 4:14 PM
>
>
> Totally.  So the controller tries to do nothing more than pass POST
> variables to the model functions and pass result arrays to the views.
>
>  <http://mc/compose?to=plug-discuss@lists.phxlinux.org>
>
> --- On *Fri, 11/30/12, Eric Cope 
> http://mc/compose?to=eric.c...@gmail.com>
> >* wrote:
>
>
> From: Eric Cope http://mc/compose?to=eric.c...@gmail.com>
> >
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> http://mc/compose?to=plug-discuss@lists.phxlinux.org>
> >
> Date: Friday, November 30, 2012, 3:16 PM
>
>
> I usually do logic in the model, unless it might be used across models,
> then I use a library.
>
> Eric
>
>
> On Fri, Nov 30, 2012 at 3:05 PM, keith smith 
> http://mc/compose?to=klsmith2...@yahoo.com>
> > wrote:
>
>
> So your suggesting the Model process the POST data and everything.  This
> is were the business logic should go?
>
>
> --------
> Keith Smith
>
> --- On *Fri, 11/30/12, Tom Haws 
> http://mc/compose?to=tom.h...@gmail.com>
> >* wrote:
>
>
> From: Tom Haws http://mc/compose?to=tom.h...@gmail.com>
> >
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> http://mc/compose?to=plug-discuss@lists.phxlinux.org>
> >
> Date: Friday, November 30, 2012, 2:00 PM
>
>
> Keith,
>
> What I'm maybe not understanding is why you are putting 100 lines of CRUD
> into the controllers.  We have all CRUD functions in the models, and we
> simply call them in the controller functions, so that they typically are
> much shorter than 100 lines.
>
> So what I would expect is 100 model files and one controller file with a
> function each for 100 pages, assuming you want to organize it that way.  I
> think another way might be to make /cp a module with each cp/page1
> cp/page2, etc a controller file with mainly only an index function in it.
>
> Tom
> Gilbert
>
> --
> "To forgive is the highest, most beautiful form of love. In return, you
> will receive untold peace and happiness." - Dr. Robert Muller
>
>
> On Fri, Nov 30, 2012 at 1:41 PM, keith smith 
> http://mc/compose?to=klsmith2...@yahoo.com>
> > wrote:
>
>
> Thank Tom,
>
> I'm already following the M-V-C like you outlined.  The database is
> normalized so no tables can be combined.
>
> For one table the controller contains about 100 lines of code for
> add/edit/delete/save/list.  For 50 tables that would be 5000 lines of code
> in one controller.
>
> If I can figure out the routing, I can create one controller per table.
> That is the optimum for me.  Otherwise I will use includes with a switch to
> determine what code needs to be included and run.
>
> Thanks again!!
>
>
>
>
> 
> Keith Smith
>
> --- On *Fri, 11/30/12, Tom Haws 
> http://mc/compose?to=tom.h...@gmail.com>
> >* wrote:
>
>
> From: Tom Haws http://mc/compose?to=tom.h...@gmail.com>
> >
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> http://mc/compose?to=plug-discuss@lists.phxlinux.org>
> >
> Date: Friday, November 30, 2012, 12:13 PM
>
>
> Keith,
>
> Remember the MVC motto "Keep models fat.  Keep controllers skinny."
> Ideally the controller is nothing but a butler or a receptionist who knows
> who does what and where to send you for what.
>
> Here's what would be the standard procedure for the Tempe, Arizona Valley
> MedTrans team.
>
> 1.  For every cp/, cp/page1, cp/page2, etc, have a function index(),
> function page1() function page2(), etc in controllers/cp.php.
> 2.  For every table (or logical "item" of business) such as article,
> user_account, inventory_item, bid, shipment, etc, have a file
> models/article_model.php, models/user_account_model.php,
> models/inventory_item_model.php, models/bid_model.php,
> models/shipment_model.php.
> 3.  Inside every ___model.php file, have functions like
> get_user_account($id), change_user_password($user_id, $new_password),
> 

Re: OT: CodeIgniter Routing

2012-12-02 Thread Tom Haws
I have a question/thought.

If a lot of the CRUD is repetitive (similar table structures), would it be
appropriate to create a models/generic_model.php that has the generic CRUD
functions/SQL and a set_table method or some other way of passing it a
table name to enhance DRY programming?

Tom
---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss

Re: OT: CodeIgniter Routing

2012-12-02 Thread Eric Cope
That's what I do. It makes it much easier. It makes testing easier too.
I made it when i extend the class, the table name is set, then I use late
static binding to reference it in the base class...

Eric


On Sun, Dec 2, 2012 at 10:26 AM, Tom Haws  wrote:

> I have a question/thought.
>
> If a lot of the CRUD is repetitive (similar table structures), would it be
> appropriate to create a models/generic_model.php that has the generic CRUD
> functions/SQL and a set_table method or some other way of passing it a
> table name to enhance DRY programming?
>
> Tom
>
> ---
> PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss

Re: OT: CodeIgniter Routing

2012-12-03 Thread keith smith

I've been looking for a solution to reducing the size of my controller by 
making multiple controllers.  

I think I may have found a solution.  It's a little complex, however I get the 
gist of it. Your thoughts?

https://gist.github.com/4157418





Keith Smith

--- On Sun, 12/2/12, Eric Cope  wrote:

From: Eric Cope 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 
Date: Sunday, December 2, 2012, 10:28 AM

That's what I do. It makes it much easier. It makes testing easier too.I made 
it when i extend the class, the table name is set, then I use late static 
binding to reference it in the base class...


Eric

On Sun, Dec 2, 2012 at 10:26 AM, Tom Haws  wrote:


I have a question/thought.

If a lot of the CRUD is repetitive (similar table structures), would it be 
appropriate to create a models/generic_model.php that has the generic CRUD 
functions/SQL and a set_table method or some other way of passing it a table 
name to enhance DRY programming?




Tom


---

PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org

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

http://lists.phxlinux.org/mailman/listinfo/plug-discuss



-Inline Attachment Follows-

---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss

Re: OT: CodeIgniter Routing

2012-12-03 Thread Eric Cope
Without seeing your code and application, it looks overly complicated...
but if it works for you, great!

Eric


On Mon, Dec 3, 2012 at 6:52 PM, keith smith  wrote:

>
> I've been looking for a solution to reducing the size of my controller by
> making multiple controllers.
>
> I think I may have found a solution.  It's a little complex, however I get
> the gist of it. Your thoughts?
>
> https://gist.github.com/4157418
>
>
>
> 
> Keith Smith
>
>
> --- On *Sun, 12/2/12, Eric Cope * wrote:
>
>
> From: Eric Cope 
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> Date: Sunday, December 2, 2012, 10:28 AM
>
>
> That's what I do. It makes it much easier. It makes testing easier too.
> I made it when i extend the class, the table name is set, then I use late
> static binding to reference it in the base class...
>
> Eric
>
>
> On Sun, Dec 2, 2012 at 10:26 AM, Tom Haws 
> http://mc/compose?to=tom.h...@gmail.com>
> > wrote:
>
> I have a question/thought.
>
> If a lot of the CRUD is repetitive (similar table structures), would it be
> appropriate to create a models/generic_model.php that has the generic CRUD
> functions/SQL and a set_table method or some other way of passing it a
> table name to enhance DRY programming?
>
> Tom
>
> ---
> PLUG-discuss mailing list - 
> PLUG-discuss@lists.phxlinux.org<http://mc/compose?to=PLUG-discuss@lists.phxlinux.org>
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
>
>
> -Inline Attachment Follows-
>
>
> ---
> PLUG-discuss mailing list - 
> PLUG-discuss@lists.phxlinux.org<http://mc/compose?to=PLUG-discuss@lists.phxlinux.org>
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
>
> ---
> PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss

Re: OT: CodeIgniter Routing

2012-12-04 Thread keith smith


It is complicated.  I downloaded pyrocms and they are doing some fancy thing 
with the Super Controller also.  Very advanced and very sophisticated.  





Keith Smith

--- On Mon, 12/3/12, Eric Cope  wrote:

From: Eric Cope 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 
Date: Monday, December 3, 2012, 8:50 PM

Without seeing your code and application, it looks overly complicated... but if 
it works for you, great!

Eric


On Mon, Dec 3, 2012 at 6:52 PM, keith smith  wrote:



I've been looking for a solution to reducing the size of my controller by 
making multiple controllers.  



I think I may have found a solution.  It's a little complex, however I get the 
gist of it. Your thoughts?

https://gist.github.com/4157418







Keith Smith

--- On Sun, 12/2/12, Eric Cope  wrote:



From: Eric Cope 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 


Date: Sunday, December 2, 2012, 10:28 AM

That's what I do. It makes it much easier. It makes testing easier too.I made 
it when i extend the class, the table name is set, then I use late static 
binding to reference it in the base class...




Eric

On Sun, Dec 2, 2012 at 10:26 AM, Tom Haws  wrote:




I have a question/thought.

If a lot of the CRUD is repetitive (similar table structures), would it be 
appropriate to create a models/generic_model.php that has the generic CRUD 
functions/SQL and a set_table method or some other way of passing it a table 
name to enhance DRY programming?






Tom


---

PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org

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

http://lists.phxlinux.org/mailman/listinfo/plug-discuss



-Inline Attachment Follows-

---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org


To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss


---

PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org

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

http://lists.phxlinux.org/mailman/listinfo/plug-discuss



-Inline Attachment Follows-

---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss

Re: OT: CodeIgniter Routing

2012-12-04 Thread Eric Cope
Pyro's is complicated because its a CMS and wants to support meaningful
URLs (like Wordpress)
Are you replicating the CMS behavior?

Eric


On Tue, Dec 4, 2012 at 9:16 AM, keith smith  wrote:

>
>
> It is complicated.  I downloaded pyrocms and they are doing some fancy
> thing with the Super Controller also.  Very advanced and very
> sophisticated.
>
>
>
> 
> Keith Smith
>
>
> --- On *Mon, 12/3/12, Eric Cope * wrote:
>
>
> From: Eric Cope 
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> Date: Monday, December 3, 2012, 8:50 PM
>
>
> Without seeing your code and application, it looks overly complicated...
> but if it works for you, great!
>
> Eric
>
>
> On Mon, Dec 3, 2012 at 6:52 PM, keith smith 
> http://mc/compose?to=klsmith2...@yahoo.com>
> > wrote:
>
>
> I've been looking for a solution to reducing the size of my controller by
> making multiple controllers.
>
> I think I may have found a solution.  It's a little complex, however I get
> the gist of it. Your thoughts?
>
> https://gist.github.com/4157418
>
>
>
> 
> Keith Smith
>
>
> --- On *Sun, 12/2/12, Eric Cope 
> http://mc/compose?to=eric.c...@gmail.com>
> >* wrote:
>
>
> From: Eric Cope http://mc/compose?to=eric.c...@gmail.com>
> >
> Subject: Re: OT: CodeIgniter Routing
> To: "Main PLUG discussion list" 
> http://mc/compose?to=plug-discuss@lists.phxlinux.org>
> >
> Date: Sunday, December 2, 2012, 10:28 AM
>
>
> That's what I do. It makes it much easier. It makes testing easier too.
> I made it when i extend the class, the table name is set, then I use late
> static binding to reference it in the base class...
>
> Eric
>
>
> On Sun, Dec 2, 2012 at 10:26 AM, Tom Haws 
> http://mc/compose?to=tom.h...@gmail.com>
> > wrote:
>
> I have a question/thought.
>
> If a lot of the CRUD is repetitive (similar table structures), would it be
> appropriate to create a models/generic_model.php that has the generic CRUD
> functions/SQL and a set_table method or some other way of passing it a
> table name to enhance DRY programming?
>
> Tom
>
> ---
> PLUG-discuss mailing list - 
> PLUG-discuss@lists.phxlinux.org<http://mc/compose?to=PLUG-discuss@lists.phxlinux.org>
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
>
>
> -Inline Attachment Follows-
>
>
> ---
> PLUG-discuss mailing list - 
> PLUG-discuss@lists.phxlinux.org<http://mc/compose?to=PLUG-discuss@lists.phxlinux.org>
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
>
> ---
> PLUG-discuss mailing list - 
> PLUG-discuss@lists.phxlinux.org<http://mc/compose?to=PLUG-discuss@lists.phxlinux.org>
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
>
>
> -Inline Attachment Follows-
>
> ---
> PLUG-discuss mailing list - 
> PLUG-discuss@lists.phxlinux.org<http://mc/compose?to=PLUG-discuss@lists.phxlinux.org>
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
>
> ---
> PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss

Re: OT: CodeIgniter Routing

2012-12-04 Thread keith smith


No we are not trying to do anything special with the URL.  I would submit that 
emulating "permalinks" is not that hard.

All you have to do is store the URL of the content in a field associated with 
that content. Then all you have to do is read the URL and use it to search on 
that field.  Pretty straight forward.





Keith Smith

--- On Tue, 12/4/12, Eric Cope  wrote:

From: Eric Cope 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 
Date: Tuesday, December 4, 2012, 9:24 AM

Pyro's is complicated because its a CMS and wants to support meaningful URLs 
(like Wordpress)Are you replicating the CMS behavior?
Eric



On Tue, Dec 4, 2012 at 9:16 AM, keith smith  wrote:




It is complicated.  I downloaded pyrocms and they are doing some fancy thing 
with the Super Controller also.  Very advanced and very sophisticated.  







Keith Smith

--- On Mon, 12/3/12, Eric Cope  wrote:



From: Eric Cope 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 


Date: Monday, December 3, 2012, 8:50 PM

Without seeing your code and application, it looks overly complicated... but if 
it works for you, great!

Eric


On Mon, Dec 3, 2012 at 6:52 PM, keith smith  wrote:





I've been looking for a solution to reducing the size of my controller by 
making multiple controllers.  





I think I may have found a solution.  It's a little complex, however I get the 
gist of it. Your thoughts?

https://gist.github.com/4157418









Keith Smith

--- On Sun, 12/2/12, Eric Cope  wrote:





From: Eric Cope 
Subject: Re: OT: CodeIgniter Routing
To: "Main PLUG discussion list" 




Date: Sunday, December 2, 2012, 10:28 AM

That's what I do. It makes it much easier. It makes testing easier too.I made 
it when i extend the class, the table name is set, then I use late static 
binding to reference it in the base class...






Eric

On Sun, Dec 2, 2012 at 10:26 AM, Tom Haws  wrote:






I have a question/thought.

If a lot of the CRUD is repetitive (similar table structures), would it be 
appropriate to create a models/generic_model.php that has the generic CRUD 
functions/SQL and a set_table method or some other way of passing it a table 
name to enhance DRY programming?








Tom


---

PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org

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

http://lists.phxlinux.org/mailman/listinfo/plug-discuss



-Inline Attachment Follows-

---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org




To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss




---

PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org

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

http://lists.phxlinux.org/mailman/listinfo/plug-discuss



-Inline Attachment Follows-

---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org


To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss


---

PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org

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

http://lists.phxlinux.org/mailman/listinfo/plug-discuss



-Inline Attachment Follows-

---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss---
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss