If you want to have shorter attributes do this:

in PHPTAL/Php/Attribute/TAL/ add new files:

file A.php :
<?php
class PHPTAL_Php_Attribute_TAL_A extends PHPTAL_Php_Attribute_TAL_Attributes{}

file C.php :
<?php
class PHPTAL_Php_Attribute_TAL_C extends PHPTAL_Php_Attribute_TAL_Content{}
....

After that go to PHPTAL/Namespace/Tal.php and change lines like:

$this->addAttribute(new PHPTAL_NamespaceAttributeContent('content', 11));
$this->addAttribute(new PHPTAL_NamespaceAttributeSurround('attributes', 9));
...

to

$this->addAttribute(new PHPTAL_NamespaceAttributeContent('content', 11));
$this->addAttribute(new PHPTAL_NamespaceAttributeContent('c', 11));
$this->addAttribute(new PHPTAL_NamespaceAttributeSurround('attributes', 9));
$this->addAttribute(new PHPTAL_NamespaceAttributeSurround('a', 9));
...

now you can use short attributes like this:

<tal:block metal:use-macro="layout.html/layout">
<tal:block metal:fill-slot="content">
<a href="http://google.com/"; tal:a="title string:12345 link" tal:c="string:12345"></a>
</tal:block>
</tal:block>

It might not work correctly with i18n attribute, I didn't tested for that. So if you don't use i18n you should be fine.

Pozdrawiam
Piotr Kroczyński


W dniu 14.07.2011 21:26, Anton Andriyevskyy pisze:
Darrell, all this sounds good, but it the same ends up that we want to have more concise html with shorter attributes. Concise (but still readable) always wins - a good example would be Scala programming language where compiler infers many things automatically but still keeps things strongly typed, and this ends up with very concise syntax, so I'm remaining sure that conciseness is good and simplifies many things. In case of phptal, not only writing of html becomes faster, but also reading - which is very important when you do refactoring and maintenance.

Regards,

Anton Andriyevskyy
Business Automation & Web Development



On Thu, Jul 14, 2011 at 8:47 PM, <s...@canterris.com <mailto:s...@canterris.com>> wrote:

    Thank you for contacting Canterris.  I???m currently out of the
    office until July 25.  Please feel free to contact Will Freemen
    (w...@canterris.com <mailto:w...@canterris.com>) or Canterris
    Technical Support (supp...@canterris.com
    <mailto:supp...@canterris.com>) for any support requests.

    _______________________________________________
    PHPTAL mailing list
    PHPTAL@lists.motion-twin.com <mailto: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
_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to