Welcome Guest, Not a member yet? Register   Sign In
Structural Question
#1

[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?
#2

[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.
#3

[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/
#4

[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.
#5

[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.
#6

[eluser]garrettheel[/eluser]
anyone?
#7

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

[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.
#9

[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.




Theme © iAndrew 2016 - Forum software by © MyBB