Ah, thanks guys, Dardo and b logica, I didn't realize cakephp had a
default method of handling static pages.  But the default cakephp way
requires the static pages to reside at the URL /pages/staticPage
too...  I'm still figuring this all out I guess.  I am about to try to
attempt to use this method (thanks Dardo): 
http://snook.ca/archives/cakephp/static_pages_cakephp12/

I like the sound of this method because it does not require making a
new route for every static page.

Now I also understand why my posts were taking so long to appear.
haha.  Hello Chris ;-)

On May 31, 7:52 pm, "b logica" <[EMAIL PROTECTED]> wrote:
> On Sat, May 31, 2008 at 1:00 PM, Turnquist, Jonah <[EMAIL PROTECTED]> wrote:
>
> > Hey I'm just starting to learn cakephp and have a question...  I was
> > wondering what the best way to handle static pages and the home page
> > is.  This is what I've done:
>
> > In the routes file I added:
> > Router::connect('/', array('controller' => 'pages'));
>
> > And I commented out these two lines:
> > //Router::connect('/', array('controller' => 'pages', 'action' =>
> > 'display', 'home'));
> > //Router::connect('/pages/*', array('controller' => 'pages', 'action'
> > => 'display'));
>
> > So now the top directory (the home page) routes to PagesController-
> >>index(); and it uses the view pages/index.ctp
> > Furthermore if I want a static /about page I create the route:
> > Router::connect('/about', array('controller' => 'pages/about'));
> > And now /about routes to PagesController->about(); and uses the view
> > at pages/about.ctp
>
> > Using this method I have to create a new route for every static page
> > as well as add an event for each static page in the PagesController.
>
> One way i handled this was to create a route for each page, like you
> have, but I used wildcards for anything within a directory
>
> Router::connect('/contact', array('controller' => 'pages', 'action' =>
> 'display', 'contact'));
> Router::connect('/links', array('controller' => 'pages', 'action' =>
> 'display', 'links'));
>
> /* /about is a directory so i have an explicit route for index and a wildcard
>  */
> Router::connect('/about', array('controller' => 'pages', 'action' =>
> 'display', 'about/index'));
> Router::connect('/about/*', array('controller' => 'pages', 'action' =>
> 'display', 'about'));
>
> I then modified pagesController::display() like:
>
> /* Allows for custom actions
>  */
> if (method_exists($this, $page))
> {
>         $this->$page();
>
> }
>
> $this->render(join('/', $path));
>
> This way, I could have many nested directories. I just had to specify
> the index page for each directory.
>
> It wasn't a big deal for that site because there were very few static
> pages and many controllers. If you plan on adding static pages all the
> time this might be tedious or prone to mistakes. If I was doing it
> over again I might approach it differently but this seems to work
> fine. The current site I'm working on is more CMS-like, with all
> content in the DB.
>
> > Also on an unrelated note, how do I find threads that I previously
> > made in google groups?  Yesterday I made a new post and it took 6
> > hours to appear.  And to see if it had any replies I have to search
> > through the Topic list
>
> I believe that newbies are moderated for some indeterminate period of
> time. Also, your posts won't be dsiplayed in your gMail INBOX (as i
> notice you're using) until someone responds to it. Although, you might
> be able to find it in the google group web page, I'm not sure. But, as
> i said, you're probably just being moderated. That will stop after a
> few posts (unless you irritate Chris ;-)
>
> A couple of times, I've sent a post off only to figure out my problem
> a minute later[1]. I realise that I can just reply to the msg in my
> SENT folder in order to cancel the cry for help.
>
> [1] b.logica's Law of Looking Like a 'Tard Online:
> No matter how many hours one spends gnashing their teeth over
> something, there's a better than even chance that the clue train will
> pull in within 5 minutes of posting a plea for help to a mailing list.
> The odds rise quickly with the degree to which the solution was a
> stupidstupidstupid oversight. Double the odds if one's original post
> explicitly stated that one checked the very damned thing it turned out
> to be.

--~--~---------~--~----~------------~-------~--~----~
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