[Catalyst] Root page for site (my first attempt!)
orasnita at gmail.com
Wed Feb 23 12:26:39 GMT 2011
From: "John M. Dlugosz" <wxju46gefd at snkmail.com>
>I just started trying Catalyst. I went through the Packt Publishing book,
>but now want a more technical explanation with details. Any suggestions on
>what documentation to read?
> With the situation as set-up by default, I would write:
> <img src="/static/images/bad_logo.png" />
> to access a site image. How can I configure it so I can write
By default, Catalyst apps keep the static content in the /static directory.
Usually you also want to configure the web server to not send the requests
to /static to Catalyst, but to serve the files directly for performance
If it wouldn't do so, think what might happen if you'll also make a
controller named "Foo" that will use the /foo path...
But you can create one or more directory with static files, for example
/images, /js, /css. These directories must be created under the root
And of course, it is recommended to configure the web server to not send the
requests to those directories to the Catalyst app.
And as Carl recommended, it is good to not hard-code the URLS in the
templates because they won't work if you'll want to make some changes and
want to put the whole application to listen to a different base than /, for
So use $c->uri_for('/path/to/static/file');
$c->uri_for_action('/path/to/action'); #for the dynamic pages
More information about the Catalyst