From: "John M. Dlugosz" <wxju46g...@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


_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to