FAQ
From: Peter Edwards
On 12 April 2011 00:50, Charlie Garrison wrote:

Good morning,

On 11/04/11 at 6:58 PM +0300, Octavian Rasnita wrote:


The TT templates used by the Catalyst app might contain many things
like c.user, c.uri_for_action, may display images, may depend on other
templates which are loaded automaticly when those templates are
specified in the app config file. So there is no sane way of using
those wrapper templates for sending email from a cron job.


That was the conclusion I was reaching; I wanted feedback from others before I tried to make my own garden path.


Put the logic in a model class that reads a config shared with but independent from your controller so you can run it outside of Catalyst.
This article outlines how to do this http://www.catalystframework.org/calendar/2007/14

At the top of that article appears:

"UPDATE: As of 2008, there is a new module which avoids the "kludgy" solution mentioned below: Config::JFDI."

At a certain moment, Config::JFDI started to support "__path_to()".

The problem is not the model only, but the templates that use the Catalyst context in them.

As it is not very recommended to access the entire Catalyst context in a model, it should be not recommended to use the context in the templates, because those templates won't be usable in external applications without loading the entire Cat app, but because using the Catalyst context in the templates is very handy, most of us probably prefer to create separate templates for using them in external apps than to provide only sane variables to all the templates.

Octavian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20110412/2ed56bda/attachment.htm

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 11 of 11 | next ›
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedApr 10, '11 at 1:10p
activeApr 12, '11 at 5:53a
posts11
users5
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2022 Grokbase