Welcome Guest, Not a member yet? Register   Sign In
URL segments
#1

[eluser]renathy[/eluser]
I am new in CI, so I have some questions regarding menu and URL segments.
I am not sure what for should I search (maybe routing or htaccess or anything else)...

So, I have three level navigation. For example:

- Info page (info)
= About myself (about)
= Friends (friends)
= Whatever else (whatever)

- Services (services)
= IT services (it)
= Some other services (other)
+ marketing (marketing)
+ sales (sales)

For every item in navigation menu I have controllers (see above in brackets).
I have the following questions:
1) Should I have controllers for every manu items or only for last level items?
2) How better handle the following situation:
- if you specify the whole url then it everything is ok (www.somepage.com/sales),
but if you specify controller from one level above (www.somepage.com/other -> this is second level navigation item, but third level navigation item needed, so source code should decide which controller of next level is default - it could be marketing or sales and redirect there?
3) I need page with controller "about" as a default page. How to manage this, as somepage.com; www.somepage.com/welcom; www.somepage.com/info; www.somepage.com/welcome/index and www.somepage.com/info/index all should actually be www.somepage.com/about/index?

4) If i have www.somepage.com/controller and www.somepage.com/controller/index actually be the same as www.somepage.com/controller/my_method, how to manage this?


Should I use redirects, htaccess, reroutes or something else?


I hope the problem is clear...
R.
#2

[eluser]isawhat[/eluser]
1. You'll want "info" and "services" as the controllers and then the other items as the functions in each controller.

2. Going by your menu layout i wouldn't have "other" as a link, just have it as title text because it would just be extra unneeded code because there has to be something set to tell the function which is default unless you have it randomly pick one.

3, 4. You can use the routing.php config to setup rules to hide the controller name for the urls are like site.com/about site.com/sales ect... rather then site.com/info/about site.com/services/sales
#3

[eluser]renathy[/eluser]
I cannot remotve links from "other", becuase "marketing" and "sales" are third level navigatin.
Third level navigation is vertical, but first-second level navigation is horizontal.
So, all should contain links.

What if I create contollers for every low level items as Imantioned above, is it absolutly wrong?

R.




Theme © iAndrew 2016 - Forum software by © MyBB