Hi,
In order to minimize the php code seen by a themer, I was wondering what people thought of making simple aliases for basic printouts of phptemplate variables. The phptemplate engine would go in and find these aliases and convert them to their actual values.
BEFORE: <?php print $content ?> <?php print $sidebar_left ?>
AFTER: {$content} {$sidebar_left}
Just looking to reduce the amount of potentially intimidating code for new themers. Of course regular PHP should still work.
Farsheed
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
BEFORE:
<?php print $content ?>
<?php print $sidebar_left ?>
AFTER: {$content} {$sidebar_left}
I, personally, see no rationale in a theming markup language. There is very little point in saying "I know you don't understand { or } but use it to encase this dollar-sign word" when the exact same mentality is required for "I know you don't understand <?php print or ?> but use it to encase this dollar-sign word".
For the same reason, I have similar complaints about wiki markup (memorize _ as opposed to the far more useful everywhere <em>) and bbcode systems (memorize [url=][/url] as opposed to the far more useful everywhere <a href=></a>).
If we're going to force people to memorize something, let's force them to memorize something *useful* and which has a semblance of repeat knowledge and value at other sites and software they may use.
I forgot to mention another idea (which is still valid php but would shorten code):
<?=$content ?> <?=$sidebar_left ?>
I can definitely appreciate Morbus Iff's sentiments. Just for clarification, I wasn't suggesting making an entire markup language, just one alias for single variable printouts.
--- Morbus Iff morbus@disobey.com wrote:
BEFORE:
<?php print $content ?>
<?php print $sidebar_left ?>
AFTER: {$content} {$sidebar_left}
I, personally, see no rationale in a theming markup language. There is very little point in saying "I know you don't understand { or } but use it to encase this dollar-sign word" when the exact same mentality is required for "I know you don't understand <?php print or ?> but use it to encase this dollar-sign word".
For the same reason, I have similar complaints about wiki markup (memorize _ as opposed to the far more useful everywhere <em>) and bbcode systems (memorize [url=][/url] as opposed to the far more useful everywhere <a href=></a>).
If we're going to force people to memorize something, let's force them to memorize something *useful* and which has a semblance of repeat knowledge and value at other sites and software they may use.
-- Morbus Iff ( if i could change the future, i'd change the past instead ) Technical: http://www.oreillynet.com/pub/au/779 Culture: http://www.disobey.com/ and http://www.gamegrene.com/ icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus _______________________________________________ themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
I forgot to mention another idea (which is still valid php but would shorten code):
<?=$content ?>
<?=$sidebar_left ?>
I believe this requires PHP's short_tags to be enabled, which we can't rely on.
When I started theming for Drupal in 2004, I knew no php, and even so I found these commands in the templates to be quite obvious.
What's more, there are plenty of resources to learn more PHP.
Adding yet more abstraction to theming seems to be undesirable, imho. After all, if one is php-phobic, there's always the Smarty theme engine.
Laura
On Jun 23, 2006, at 11:04 AM, Farsheed wrote:
Hi,
In order to minimize the php code seen by a themer, I was wondering what people thought of making simple aliases for basic printouts of phptemplate variables. The phptemplate engine would go in and find these aliases and convert them to their actual values.
BEFORE:
<?php print $content ?>
<?php print $sidebar_left ?>
AFTER: {$content} {$sidebar_left}
Just looking to reduce the amount of potentially intimidating code for new themers. Of course regular PHP should still work.
Farsheed
Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
The idea sounds good in theory. The old xtemplate engine had these markups in it.
With PHP Template, PHP *is* the templating language.
Not sure if many people find PHP a barrier or not. Laura for one is a case that this is not really a problem to be solved.
I have to agree, I didn't know any php either and found it easy to understand. I was coming from MovableType after their pricing debacle, so tag formatting was what I knew.
What was hard, and still is, is trying to figure out what can be themed. It's felt like, and still does to an extent, like a velvet curtain is pulled over the guts of Drupal.
Erik
Laura Scott wrote:
When I started theming for Drupal in 2004, I knew no php, and even so I found these commands in the templates to be quite obvious.
What's more, there are plenty of resources to learn more PHP.
Adding yet more abstraction to theming seems to be undesirable, imho. After all, if one is php-phobic, there's always the Smarty theme engine.
Laura
On Jun 23, 2006, at 11:04 AM, Farsheed wrote:
Hi,
In order to minimize the php code seen by a themer, I was wondering what people thought of making simple aliases for basic printouts of phptemplate variables. The phptemplate engine would go in and find these aliases and convert them to their actual values.
BEFORE:
<?php print $content ?>
<?php print $sidebar_left ?>
AFTER: {$content} {$sidebar_left}
Just looking to reduce the amount of potentially intimidating code for new themers. Of course regular PHP should still work.
Farsheed
Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
OK, let's nix my idea then :)
Erik, I feel your pain. Between the core theme functions, module's theme functions, tpl.php files, and the numerous CSS files loaded in - it's very difficult to even trace what's happening on a single page load. If there were some way to at least tell what was loaded and from where (something like the devel module) it seems like that velvet curtain would become slightly more transparent.
Farsheed
--- Erik Mallinson erik@invisiblelantern.com wrote:
I have to agree, I didn't know any php either and found it easy to understand. I was coming from MovableType after their pricing debacle, so tag formatting was what I knew.
What was hard, and still is, is trying to figure out what can be themed. It's felt like, and still does to an extent, like a velvet curtain is pulled over the guts of Drupal.
Erik
Laura Scott wrote:
When I started theming for Drupal in 2004, I knew
no php, and even so
I found these commands in the templates to be
quite obvious.
What's more, there are plenty of resources to
learn more PHP.
Adding yet more abstraction to theming seems to be
undesirable, imho.
After all, if one is php-phobic, there's always
the Smarty theme engine.
Laura
On Jun 23, 2006, at 11:04 AM, Farsheed wrote:
Hi,
In order to minimize the php code seen by a
themer, I
was wondering what people thought of making
simple
aliases for basic printouts of phptemplate
variables.
The phptemplate engine would go in and find these aliases and convert them to their actual values.
BEFORE:
<?php print $content ?>
<?php print $sidebar_left ?>
AFTER: {$content} {$sidebar_left}
Just looking to reduce the amount of potentially intimidating code for new themers. Of course
regular
PHP should still work.
Farsheed
Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam
protection around
http://mail.yahoo.com _______________________________________________ themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Op vrijdag 23 juni 2006 19:04, schreef Farsheed:
Hi,
In order to minimize the php code seen by a themer, I was wondering what people thought of making simple aliases for basic printouts of phptemplate variables. The phptemplate engine would go in and find these aliases and convert them to their actual values.
BEFORE:
<?php print $content ?>
<?php print $sidebar_left ?>
AFTER: {$content} {$sidebar_left}
Just looking to reduce the amount of potentially intimidating code for new themers. Of course regular PHP should still work.
Two reason why this is a bad idea:
Aliases are bad. PHPtemplate already offers far too many "ways to Rome". Work out *one* way in detail, make sure its documented WELL. As opposed to: offer a gazillion tricks and hidden gems, that are neither documented nor obvious to newbies and gurus. I theme with PHPT daily, yet still cannot grok certain thingies, because these thingies can be done in fourteen different ways, you need to know all fourteen, and remember all their specifics, pros and cons.
PHP is *not* intimidating. I have yet to find the designer who finds <?php print $content ?> less obvious, or harder, or more intimidating then {{content}}.
This statement becomes more obvios, when you need more complexity, like conditions: {{[[if:content!=""]] <div>{{content}}</div> }} As opposed to: <?php if ($content): ?> <div><?php print $content ?></div> <?php endif; ?>
But most important: There are a gazillion books, tutorials, helpers, courses, schools, manuals etc on PHP. PHP works with most editors, Dreamweaver, yes even photoshop support PHP. But some DrupalSyntax is not supported, let alone that people can learn it outside of Drupal. Let alone that someone wants to invest in learning something that he/she can only ever use with Drupal.
We should not try to invent some new things, but rather make the current system a tad simpler and more obvious. Document it better, make behaviour a lot more consistent. Why do I, as Drupal-nitwit, need to print sometimes $name, other times $title, sometimes $comment->subject and again other times $object->title? For drupal devels this is obvious (we know that a term is like $term->name, while a node like $node->title, but a comment gets $comment->subject). Why do I sometimes need some code in template.php, but in other cases just use a box.tpl.php? Again: we know it, because we know the code behind PHPtemplate. But we have to admit that it is *far* from logic if you dont know that.
I am certain that if we focus our energy on these weird things, or inconsistencies we gain a LOT more then if we invent Yet Another Scripting Language.
Bèr
This is actually the smarty theme system to a tee. See:
http://smarty.php.net/crashcourse.php and scroll down to "index.tpl".
I actually find smarty much more intuitive. Common excuses:
But you can't have control structures: http://smarty.php.net/manual/en/language.function.if.php http://smarty.php.net/manual/en/language.function.section.php http://smarty.php.net/manual/en/language.function.foreach.php
But you can't get advanced variables from Drupal: http://smarty.php.net/manual/en/language.variables.php
But you can't run PHP code/But it's not powerful enough: http://smarty.php.net/manual/en/language.function.php.php
But you can't include files: http://smarty.php.net/manual/en/language.function.include.php http://smarty.php.net/manual/en/language.function.include.php.php
But it's hard to do formatting: http://smarty.php.net/manual/en/language.modifiers.php
But the theme engine isn't kept up to date: http://drupal.org/project/smarty
Robin
On 6/23/06, Farsheed tfarsheed@yahoo.com wrote:
Hi,
In order to minimize the php code seen by a themer, I was wondering what people thought of making simple aliases for basic printouts of phptemplate variables. The phptemplate engine would go in and find these aliases and convert them to their actual values.
BEFORE:
<?php print $content ?>
<?php print $sidebar_left ?>
AFTER: {$content} {$sidebar_left}
Just looking to reduce the amount of potentially intimidating code for new themers. Of course regular PHP should still work.
Farsheed
Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes