fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] dw_dev2011-01-01 12:46 pm
Entry tags:

Constants Namespaces in .tt files

I'm looking for feedback on Bug 3170: Constant Namespaces in DW::Template.

Basically, right now our constants in .tt files can be found under email.*, site.*, roots.*, etc, and the more constants we have, the more likely it is that we'll accidentally have a namespace collision. So I would like to have all constants be under just the site namespace.

That is, instead of using:
email.webmaster
roots.site
site.name

We can use:
site.email.webmaster
site.root
site.name

In some cases, it's longer, but the additional clarity should be worth the extra characters. (Plus it would also make it easier to avoid mistakes -- I found several instances of dw.* in the files, which are blank, but luckily cause no issues)


site.name = $LJ::SITENAME
site.names.short = $LJ::SITENAMESHORT
site.names.abbrev = $LJ::SITENAMEABBREV

site.company = $LJ::SITECOMPANY

site.email.coppa = $LJ::COPPA_EMAIL
site.email.privacy = $LJ::PRIVACY_EMAIL

site.domain = $LJ::DOMAIN
site.domains.web = $LJ::DOMAIN_WEB

site.root = $LJ::SITEROOT
site.roots.img = $LJ::IMGPREFIX
site.roots.ssl = $LJ::SSLROOT

site.help.* = \%LJ::HELPURL





I'd like to point out, in particular,
site.name = $LJ::SITENAME
site.names.short = $LJ::SITENAMESHORT
site.names.abbrev = $LJ::SITENAMEABBREV

which suffers from inconsistency/needing to be aware of the technical limitations.

An alternative:
site.name.site = $LJ::SITENAME
site.name.short = $LJ::SITENAMESHORT
site.name.abbrev = $LJ::SITENAMEABBREV

But that suffers from the problem that the most commonly used variable, site.name, becomes long/ridiculous/redundant.

Post a comment in response:

If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org