[Catalyst] Re: javascript in Catalyst using Template Toolkit
kevin montuori
montuori at gmail.com
Sat Dec 22 14:06:24 GMT 2007
>>>>> "AP" == A Pagaltzis <pagaltzis at gmx.de> writes:
AP> * Daniel McBrearty <danielmcbrearty at gmail.com> [2007-12-22 00:30]:
>> on the other hand, if you are running your app on a server that you
>> own and do admin for, and don't have such admin problems to negotiate,
>> it would be fine, eh? horses for courses and all that.
you probably have a good point but i don't believe it. to me this
reeks of "shortcuts" like running everything as root on a unix box or
using PHP. i would argue that writing code as if someone else were
going to deploy it and maintain it leads to good programming practices
(as well as frills like documentation, sensible built-in debugging,
real packaging, meaningful log messages, &c.) even if you're a one man
shop. consider: any code that you haven't looked at in six months may
as well have been written by somebody else anyway.
sorry to stray so far from the topic at hand; i've spent the last
couple years fixing former sysadmins' code/environment and your
mindset hit a nerve. if it works for you, honestly, that's super.
AP> Is it appreciably less work to omit the `[% c.uri_for('') %]`?
AP> It less than 20 extra characters up front.
obCatalyst: let me add that if you use emacs [insert emoticon of your
choice] you could define a little function like:
(defun ii-insert-catalyst-url ()
(interactive)
(let ((path (read-from-minibuffer "URI: ")))
(insert (format "<a href=\"[%% Catalyst.uri_for('%s') %%]\"></a>" path))
(backward-char 4)))
to do the work for you. if you're accustomed to using html-mode or
sgml-mode you might even rebind C-c C-c h (html-href-anchor):
(add-hook 'html-mode-hook
'(lambda ()
(define-key html-mode-map "\C-c\C-c\h" 'ii-insert-catalyst-url)))
and there'd be no new finger memory to develop, so no extra work
whatsoever.
cheers.
k.
--
kevin montuori
More information about the Catalyst
mailing list