Welcome Guest, Not a member yet? Register   Sign In
How to setup my webpages when dealing with different blocks of info?
#1

[eluser]123wesweat[/eluser]
Hi there,

I am just starting out with CI and i like to know how to setup/dealing with the following:

- homepage; different blocks of information (like, summary of the latest subpage's information, number of form, agenda, profile information etc)

- subpages have different views and some of them have blocks of info from other subpages

What would be a good way to set it up with SEO/security and good practice in mind?? The controller/method/params confuses me.

- Should i make models for each block of information?
- Or should i make a 'homepage' model with all functions.
- Should i make a view for each block or a template??
- What is the max of nested views??
- Every interaction with the DB should go into models, right??

All is db-driven.

Any suggestions, starting points??

regards,

ps: transforming to a MVC mindset
#2

[eluser]Aniket[/eluser]
it seems like you have come from a CMS background...np
CI supports SEO friendly urls so u dont have to worry much...
With the topic of displaying blocks ..ideal would be a library..which pulls data from the Database and generates a view.
The controller/method/params is easy to understand..say every important page you want to display to user will have a method in the controller which is the only point of contact for the clients.
Use Models to represent your business entities like "User", "Employee", "Shopping cart" i.e the things you want to store in db..
Following shall be the probable work flow..
Say,
controllers/home.php is the controller.
libraries/renderer.php is your library for displaying your different blocks(library will contain implementation for fetching the data and generating the desired view).
Library makes use of Model if required to process some user specific data.
The view generated by the library is returned to the controller and the controller then appropriately adds the view to the desired main view.
Also its not compulsory that all db related tasks should go in Models...Libraries can also contain db related code.

Hope this helps...pls feel free to ask any doubts for clarification.

Thanks in advance.




Theme © iAndrew 2016 - Forum software by © MyBB