FAQ
From: "John M. Dlugosz" <wxju46gefd@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
src="foo/bad_logo.png"
instead?

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
reasons.

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
directory.
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
example /old-site.

So use $c->uri_for('/path/to/static/file');
or
$c->uri_for_action('/path/to/action'); #for the dynamic pages

Octavian

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 7 | next ›
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedFeb 23, '11 at 11:30a
activeFeb 24, '11 at 12:13p
posts7
users4
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2022 Grokbase