Pretty sure this could be easily implemented at a prefilter, using DOM +
XPaths to search for the aliases and replace them with the full attribute
names.

I would, however, recommend avoiding this altogether.  Implementing any such
solution, whether it be a prefilter or in the core of phptal, will increase
the complexity of the markup language (eg, markup for feature X can now be
represented as X or Y or...) which goes hand in hand with a decrease in
readability of said markup.  In addition, any home grown solution will
reduce the compatibility of your mark up with anyone else.  Though this last
point probably won't be a problem for most people, you just have to remember
to convert your <tal:b />s and <div tal:attr="" />s to their proper forms if
you plan to ask questions on the mailing list.

If your only concern is not wanting to type out the whole name of the
attribute or element, I would suggest investigating what your text editor
has to offer.  Many modern editors support user defined macros and/or auto
completions which will get you the best of both worlds, less to type and
maintaining compatibility with the standard markup.

Darrell Hamilton,
Software Developer,
4over, Inc
darre...@4over.com
818-246-1170 ext. 285


On Thu, Jul 14, 2011 at 1:18 AM, romtek <rom...@gmail.com> wrote:

> On Mon, Jul 11, 2011 at 2:43 AM, Anton Andriyevskyy <x.meg...@gmail.com>wrote:
>
>> Is there a way to easily define aliases & use them for shorter syntax like
>> tal:b instead of tal:block,
>> tal:c instead of tal:content, tal:a instead of tal:attributes etc? It's
>> becoming useful when you are
>> kind of PHPTAL guru and you do not want to type these long words
>> everywhere, you just want to get it faster and more concise.
>>
>> Regards,
>>
>> Anton Andriyevskyy
>>
>
>
> I've asked a similar question in the past but never got a reply. (I asked
> if we could have tal:attr alias.) Support of aliases would be a very
> convenient feature.
>
> Roman
>
> _______________________________________________
> PHPTAL mailing list
> PHPTAL@lists.motion-twin.com
> http://lists.motion-twin.com/mailman/listinfo/phptal
>
>
_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to