[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Patrick May

1/17/2005 9:40:00 PM

Hello,

One of the nice things about php is that the '<?>' keys are close to
each other. One of the annoying things about asp and jsp is that '<>'
use one hand, and '%' uses another.

Attached is a patch to erb.rb that allows ?'s as well as %'s in erb
templates:

<% puts "this works" %>
<? puts "as does this" ?>

Let me know if there is anything I can do to make this a better patch.
If you want to play with this, you can grab the patched version of erb
from narf:

http://svn.narf-lib.org/svn/narf/trunk/lib/we...

I renamed the constant to PHPRB, so as not to collide with the standard
lib.

Cheers,

Patrick



11 Answers

Aria Stewart

1/17/2005 9:43:00 PM

0

On Tue, 2005-01-18 at 06:39 +0900, Patrick May wrote:
> Hello,
>
> One of the nice things about php is that the '<?>' keys are close to
> each other. One of the annoying things about asp and jsp is that '<>'
> use one hand, and '%' uses another.
>
> Attached is a patch to erb.rb that allows ?'s as well as %'s in erb
> templates:
>
> <% puts "this works" %>
> <? puts "as does this" ?>

+1 in concept, because XML standards suggest it this way, too. However,
<?ruby is better, following the XML processing-instructions spec.



Patrick May

1/17/2005 9:44:00 PM

0

Hello,

I've had some trouble sending the patch over. It is available here:

http://www.narf-lib.org/php...

Cheers,

Patrick



Douglas Livingstone

1/17/2005 9:52:00 PM

0

> > <? puts "as does this" ?>
>
> +1 in concept, because XML standards suggest it this way, too. However,
> <?ruby is better, following the XML processing-instructions spec.

or just, <?r ?>

(The PHP people say not to use shorttags (<?= $var ?>) too, there was
a zend contest here the 2nd place guy got put down to 6th for that!
And the best prizes were in the top 5 :p )

Douglas


Luis G. Gómez

1/17/2005 10:02:00 PM

0

<?rb ?> gets my vote

Douglas Livingstone wrote:
>>> <? puts "as does this" ?>
>>
>>+1 in concept, because XML standards suggest it this way, too. However,
>><?ruby is better, following the XML processing-instructions spec.
>
>
> or just, <?r ?>
>
> (The PHP people say not to use shorttags (<?= $var ?>) too, there was
> a zend contest here the 2nd place guy got put down to 6th for that!
> And the best prizes were in the top 5 :p )
>
> Douglas
>
>


Stefan Scholl

1/17/2005 11:03:00 PM

0

On 2005-01-17 22:42:32, Aredridel wrote:

> +1 in concept, because XML standards suggest it this way, too. However,
> <?ruby is better, following the XML processing-instructions spec.

Why bother? I don't think something like

<a href="foo/?baz=<?ruby print xyz.poo(42) ?>">

is valid XML either.

Eric Hodel

1/18/2005 12:15:00 AM

0

On 17 Jan 2005, at 13:39, Patrick May wrote:

> Hello,
>
> One of the nice things about php is that the '<?>' keys are close to
> each other. One of the annoying things about asp and jsp is that '<>'
> use one hand, and '%' uses another.

That's because you're using the wrong keyboard. Switch to dvorak
layout. ;)

Its even easier than <?, because you're not using your pinky to hit one
of the keys.

(No, really this kinda stuff is useful. :)

--
Eric Hodel - drbrain@segment7.net - http://se...
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04

gabriele renzi

1/18/2005 5:59:00 AM

0

Douglas Livingstone ha scritto:
>>> <? puts "as does this" ?>
>>
>>+1 in concept, because XML standards suggest it this way, too. However,
>><?ruby is better, following the XML processing-instructions spec.
>
>
> or just, <?r ?>

+1 for <?r (which IIRC is Nitro's way of doing things :)

George Moschovitis

1/18/2005 9:17:00 AM

0

Btw, this is EXACTLY what Nitro uses:

<?r if user.role("admin") ?>
....
<?r end ?>

or even

<?ruby .... ?>

or even
<ruby>...</ruby>


check this out: www.rubyforge.com/projects/nitro

George Moschovitis

1/18/2005 9:21:00 AM

0

> Why bother? I don't think something like
> <a href="foo/?baz=<?ruby print xyz.poo(42) ?>">
> is valid XML either.

but,

<a href="foo/?baz=#{xyz.poo(42)}">...</a>
as used in Nitro is valid xml :)

-G.

Stefan Scholl

1/18/2005 5:23:00 PM

0

On 2005-01-18 10:21:14, George Moschovitis wrote:

>> Why bother? I don't think something like
>> <a href="foo/?baz=<?ruby print xyz.poo(42) ?>">
>> is valid XML either.
>
> but,
>
> <a href="foo/?baz=#{xyz.poo(42)}">...</a>
> as used in Nitro is valid xml :)

<a href="foo/?baz=23" <?ruby if xyz.poo(42) ?> target="moep"
<?ruby else ?> title="Example" <?ruby end ?>>