Hey Joe,

I would advise you rethinking about how you go about constructing your
website.  Why would you have different databases for the different
events?  Why not have one common table named "events" then you can put
the information you need in there.  Then you would make one controller/
model/view for events.  It would make calling the events so much
easier.  That's similar to how I constructed http://www.countycriminal.com
I have one master table of all the counties then I just use some
custom URL rewriting in the bootstrap.php file to make it call back to
one controller.  Of course there's lots of other aspects thrown in but
overall that's one way I did things.

How you are doing it will become very difficult to maintain in the
future.  Look into folding all the tables into one, and then run a
query similar to:
<?php
$getEventsWithinRange = array('startdate BETWEEN ? AND ?'=>array(date
("Y-m-d"),date("Y-m-d",strtotime("+2 weeks")));
$get_events = $this->Event->find('all',array('conditions'=>
$getEventsWithinRange));
?>

What that code above will do is give you all the events from today to
+2 weeks.  That way you can show the upcoming events easily.  Make
sure your Events table has a field named startdate which will be the
date (YYYY-MM-DD) the event starts.

Take care,
Chad

On Dec 22, 4:56 am, Joe L <[email protected]> wrote:
> Hi,
>
> I am new to cakePHP and I am not sure whether this is the correct
> object-oriented way to build my landing page. Please help!
>
> I have a website that storing information on different types of
> upcoming events. And I have each controller/model/database tables for
> each type of my event, let's say motor_show, trade_fair...etc
>
> In my landing page, I will display a list of upcoming events of ALL
> types, therefore I need access to many tables in the page.
>
> So I use 'views/pages/home.ctp' as my landing page. And I would call
> the functions in each of the controller to retrieve the data for my
> landing page use requestActions().
> for eg.
> <?php echo $this->requestAction('/motor_shows/displayUpcoming');?>
> <?php echo $this->requestAction('/trade_fair/displayUpcoming');?>
>
> Thanks.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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

Reply via email to