CodeIgniter Forums
Structural Question - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Structural Question (/showthread.php?tid=13896)



Structural Question - El Forum - 12-10-2008

[eluser]garrettheel[/eluser]
So this is more of an application structure question then it is about the code. Basically, I want to create a simple blog to use with my site. I already have an /admin controller which contains the admin functions for the site so I thought it would be logical to have the blog admin in there (e.g the create/update/delete functions). However, I'm wondering how I'd structure it?

Basically, I'd want to be able to go mysite.com/admin/blog/add or /admin/blog/edit/16 (where 16 is the ID of the post). As it currently is, I believe the third url parameter is supposed to be the first argument in the function. How would you guys suggest I go about making the blog?


Structural Question - El Forum - 12-10-2008

[eluser]Chris Williams[/eluser]
If admin is the controller, and it's only for the blog, then I don't thin you need 'blog' as a segment, you can use edit as a function in the controller that way.


Structural Question - El Forum - 12-10-2008

[eluser]garrettheel[/eluser]
Admin isn't just for the blog though - it controls all the admin functions for the site. The blog is just a component of the site, so I'd like to separate it from the other admin controls in /blog/


Structural Question - El Forum - 12-10-2008

[eluser]Chris Williams[/eluser]
I would put admin in its own folder and create controls from that. That way they aren't all residing one single control.

I think you can make a new folder called admin within the controllers folder and be good to go.


Structural Question - El Forum - 12-10-2008

[eluser]garrettheel[/eluser]
so then I could have

/admin/blog.php
/admin/something.php

And read it like mysite.com/admin/blog? It seems like I'd need to add some sort of custom routing or htaccess changes.


Structural Question - El Forum - 12-11-2008

[eluser]garrettheel[/eluser]
anyone?


Structural Question - El Forum - 12-11-2008

[eluser]xwero[/eluser]
i think you answered your own question


Structural Question - El Forum - 12-11-2008

[eluser]Colin Williams[/eluser]
Yeah. Iteration and an open copy of the user guide is much better that typing "anyone?" to bump a thread. That's a legit suggestion, too. I'm not just being and ass.


Structural Question - El Forum - 12-11-2008

[eluser]garrettheel[/eluser]
Well, I understand that's a fine way to structure but I was wondering how to make CI use this type of URL /admin/blog/function/param ?

Edit: nevermind, got it all sorted. Thanks for those who helped anyway.