new to Cake, help with setting up site's infrastucture

2007-05-04 Thread Scitt

Let me start by saying I am a complete novice to Cake PHP but plan to
change that very soon, I am an intermediate php developer and can't
wait to start using this framework for new apps I am developing.

I don't see the whole picture yet and could use some assistance in
getting started.

i'm using mysql 4.0.25 and php 4.3.8.

This site revolves around a user's selected city.  The homepage pretty
much is a listing of all the available cities which then takes you to
that specific cities page.  All the code for a specific city is the
same as any other city, the only difference is the data being pulled
from the database only relates to that specific cities id.  A sample
file/folder structure would be:

index.php (listing of cities)
/city/index.php?city=1
/city/index.php?city=2
/city/index.php?city=3

My confusion lies with incorporating this functionality in the MVC
programming pattern.  Any help or assistance in getting this started
would be very helpful!

Thanks,

Scitt


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: new to Cake, help with setting up site's infrastucture

2007-05-04 Thread gwoo

You would create a CitiesController with a City model.
Your URL would be /cities/view/1 for the city with id 1.
You could use this to set a Session that would allow the current city
to persist across other controllers.

hope this helps.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: new to Cake, help with setting up site's infrastucture

2007-05-04 Thread Bootstrapper

Some more details that might help:

Inside your CitiesController you would have a view() action (a
function) that you can pass the city id too.

Just in case you need to get really basic with how the MVC aspects
work (broken into MVC):

After requesting the url suggested by gwoo: /cities/view/1

C - the Controller:

The action called view, in your CitiesController, requests that city's
data from the model using something like find()

M - the Model

The City model searches the Cities database table for the record with
the matching city id and returns the data to the Controller. (This is
done automatically for you by calling find() or an equivalent in the
controller. Once the model is initially set up, you won't need to add
anything to make this process work.)

The CityController then passes that to the view using set()

V - the View

The view called view.thtml then prepares the html served to the
browser.

-
You also mentioned the homepage having a listing of all cities. That
could also be in your CitiesController. You could have an action
called ViewAll that uses findAll() to get all the cities. The
controller would pass that data in an array to the view to display.

Actually, I think you can really use the beauty of Cake here by just
making a DB table for Cities, then using the bake feature to bake
everything we just talked about including the model, views, controller
and actions + adding, editing and deleting cities! You'll be amazed!

Hope that helped and good luck!



On May 4, 1:15 pm, gwoo [EMAIL PROTECTED] wrote:
 You would create a CitiesController with a City model.
 Your URL would be /cities/view/1 for the city with id 1.
 You could use this to set a Session that would allow the current city
 to persist across other controllers.

 hope this helps.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---