CodeIgniter Forums
CI and a very standard website - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: CI and a very standard website (/showthread.php?tid=1938)



CI and a very standard website - El Forum - 07-06-2007

[eluser]Ericks[/eluser]
Hey guys,

I'm considering CI for a corporate website. I've been looking at a lot of examples and tutorials and it looks very promising. However there is one thing that I do not understand.

As you know, CI 'links' paths in the URL to functions in classes (products/car links to the class product function car). This makes sense but what would I do if I have like tens of pages that all just have information on them and for the rest look the same? Ideally I would like to link the path in the URL to some tree-based organisation in the database, so 'products/car' would link to a page called 'car' that is a child of the page 'product' in the database (I am going to need a backend that is organized like this).

I saw the URL routing method, and I suppose that would work but is that the way to go? Becuase that would mean 1 controller and changing the 'template' (the view) would be less trivial.

Basically: Considering this case, what controllers and views would you guys create?

Thanks!


CI and a very standard website - El Forum - 07-06-2007

[eluser]frenzal[/eluser]
I made a treebasedurl structure, to do this I have a default controller where I route everything to (/:all -> corecontroller). Then I look at the segments, for instance about/company/contact. If you don't have a crazy amount of pages and all your link names are unique, you could just simply grab the last segment and look up the page data in your db with that. If you have page names that aren't unique you'll have to examine more then one segment..


CI and a very standard website - El Forum - 07-06-2007

[eluser]Colin Williams[/eluser]
Sounds like all you need is a content management system, and not an application framework. I'd look into Expression Engine and Drupal


CI and a very standard website - El Forum - 07-07-2007

[eluser]dshafer[/eluser]
I have a similar situation to the original poster's here. My site -- and I'm guessing I'm not only not unusual but may be more the rule than not -- is a mixture of content pages which have the same layout (template) into which I just want to squeeze different contents. But I also need special functionality that CI makes really easy to get. So it's a hybrid.

I'm struggling now with the question of the best way to get what I want. Any thoughts, insights and experiences will be welcome!


CI and a very standard website - El Forum - 07-07-2007

[eluser]Developer13[/eluser]
Does this help at all?

http://www.ellislab.com/codeigniter/user-guide/general/controllers.html#remapping


CI and a very standard website - El Forum - 07-07-2007

[eluser]dshafer[/eluser]
That may well be a key to my particular needs. Thanks for the pointage. I'm going to dig into that a bit.


CI and a very standard website - El Forum - 07-07-2007

[eluser]Colin Williams[/eluser]
An answer in the user guide!? Who'd of thought!? Smile


CI and a very standard website - El Forum - 07-09-2007

[eluser]Ericks[/eluser]
thanks for the replies guys.
1. a CMS is not what I need. My wishes are too specific. Besides, Drupal does not support a page tree structure at all. ModX does but has a couple other major drawbacks.

2. I did read about the remapping feature but it doesn't seem the best way to go because you would still have to define multiple controllers for all of your toplevel menu items right? Alternatively it would require routing all requests to that particular controller.


CI and a very standard website - El Forum - 07-09-2007

[eluser]Colin Williams[/eluser]
Quote:Drupal does not support a page tree structure at all.

Look again. This is handled by the menu system.

And you would only need one controller if your route all requests to one controller. That controller could then just query the database for the page with a path of 'products/cars', or perhaps 'products' is a parent-id or something along those lines. But then all you really end up with is a small version of Drupal/any-other-cms-I've-looked-at.


CI and a very standard website - El Forum - 07-16-2007

[eluser]Ericks[/eluser]
Drupal handles pages based on taxonomy, not a page tree. A fully dynamic menu is only possible like described here:
http://drupal.org/node/53085
which is not very intuitive for something as basic as a menu system. It is understandable too, Drupal is a community/weblog cms and the taxonomy system is very helpful in those applications. It just doesnt have a page tree. What the above page provides is a hack that turns the taxonomy system into a page tree but for me thats by far not flexible enough.

If I would route everything to 1 controller I could match the path 'products/cars' to the pagetree-node 'cars' which is a child of 'products' which is attached to the root node, which is what I would need.