- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsI'm new to codeigniter but I'm very familiar with PHP.
But i'm really struggling to build a good file structure using codeigniter.
My problem is that I really want o rely on the framework and standards since I can get the task done regardless.
now I'm building a new website from scratch. and I want to have "about us" & "contact us" pages. How can I make them (not How but more what is the standard in codeigniter):
1) Should I have one controller and it calls multiple view files (one view file for "about us") and another for "contact us"? [meaning the actual HTML details of the page like phone number and stuff will be in the view file]
2) should each have two file, the "about" should have it's controller file and it's view file and
"contact us" the same?
3) Should I have two controllers and in this controller I should prepare all my code (even if I used obstart() ) and both controllers call this one template view file? [meaning the actual HTML data like the phone number and divs will be in the control file and passed through a variable to the view for display]
all three cases can be done and it's not about the technicality, it's following the standard that will eventually help on the long run
Thank you.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: adrian_brooksPosted on 2009-10-12 at 08:48:35ID: 25552235
Hello bhefny,
ut
ut/update
In my CI developments, I tend to use the more traditional MVC constructs where I will create a controller file for each page I intend to serve. The reasoning for this is as follows.
If I have an "about" page and a respective about controller, then when I call that page, it will be a simple http://www.example.com/abo
If I want to add about specific 'actions', like updating the page, I can then add actions within the about controller that then act in a perceived relationship to that page. Not to mention that all of the about controller's class object properties are immediately available to me for use in respective code. So, if I did have the 'update' action, then the call to it would now be a direct derivative of the base URL.
i.e. http://www.example.com/abo
You can call whatever views you desire from within any controller, so this grants you the ability to have numerous views on an as needed basis specific to that particular controller's requirements.
This approach also provides the highest level of scalability as well.
Hope this helped you out. :)
~A~