Jump to content

Creating a cms


Iluvatar+

Recommended Posts

I am building a cms in cakephp, well i haven’t yet started but i have a good idea on what i want. I have never really used MVC before so it's quite confusing to say the least.

 

I want a index page which can hold numerous controllers so I am able to have control over multiple tables in my database from just one view. Is this possible...? Also does anyone know of any good tutorials or help info that can guide me a bit better throughout this project?   

 

Link to comment
Share on other sites

I don't understand, why do you need to to use multiple controllers to have access to multiple tables, just select or update or insert into the tables, unless each of your controllers has a different useraccount or database.. and even still, its just a matter of centralizing all of that information in an include file, and include that file into each of the controller files..

 

Sorry if I'm a little clueless here, care to elaborate more?

Link to comment
Share on other sites

I've only ever done light work with CakePHP So I'm probably not the best for this question, but I did a quick google search, and came up with a result which sounds very close to what you're looking for:

 

http://stackoverflow.com/questions/93632/cakephp-view-including-other-views

 

however, you shouldn't need a separate view for a "view all posts" view, unless you plan to use that same view elsewhere, than I guess it makes sense to have it set up like an include, but, check the link above :)

 

Sorry I wasn't enough help!

Link to comment
Share on other sites

I haven't used CakePHP, but many MVC frameworks offer partial views which you can include into your main view. I haven't looked to see if CakePHP offers this or not, but it may be worth looking into.

 

Aside from that, in your controller you can have multiple methods all with their own view. You would use them by going to example.com/index/method1, example.com/index/method2, example.com/index/method3 etc. Maybe that is what you are looking for.

Link to comment
Share on other sites

Or you could store the page data (in your database) with a field for "view type" which could hold a number corresponding to a particular view layout (that's what i did when i built my own little cms to practice).  So when your  controller calls the  model, that model will pull down the "view type" along with the page data and the controller can then use that "page type" number to render the necessary view.

 

 

 

I am building a cms in cakephp, well i haven’t yet started but i have a good idea on what i want. I have never really used MVC before so it's quite confusing to say the least.

 

I want a index page which can hold numerous controllers so I am able to have control over multiple tables in my database from just one view. Is this possible...? Also does anyone know of any good tutorials or help info that can guide me a bit better throughout this project? 

Link to comment
Share on other sites

I dont quite follow you on this one.

 

Or you could store the page data (in your database) with a field for "view type" which could hold a number corresponding to a particular view layout (that's what i did when i built my own little cms to practice).  So when your  controller calls the  model, that model will pull down the "view type" along with the page data and the controller can then use that "page type" number to render the necessary view.

 

 

Thanks for the replies...

Link to comment
Share on other sites

When you store you page data in the database have a column for "page type".

 

So in your code:

 

Page type of 1 = Two col. layout

Page type of 2  = three col. layout with blog posts

 

 

so when your controller talks to the model for data, the model will return the page data requested and  the 'page type' number. Then when you call the view controller you can have some logic to call a different layout depending on the page type. And this way you can acheive multiple layouts.

 

There might very well be a better way and i did it this way just because it made sense to me. But it worked ok for me.

 

 

I dont quite follow you on this one.

 

Or you could store the page data (in your database) with a field for "view type" which could hold a number corresponding to a particular view layout (that's what i did when i built my own little cms to practice).  So when your  controller calls the  model, that model will pull down the "view type" along with the page data and the controller can then use that "page type" number to render the necessary view.

 

 

Thanks for the replies...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.