Feature Requests: Browse | Submit New | Admin

[#1548] Arguments for booleans and loops

Date:
2005-02-25 22:42
Priority:
1
Submitted By:
Greg Millam (walker)
Assigned To:
Greg Millam (walker)
Category:
None
State:
Open
Summary:
Arguments for booleans and loops

Detailed description
Request the ability for variable names to include an argument.

Example:
  I have a class User with has_role?(rolename) - rolename being 'guest,' 'member,' 'admin,' or the like. (My actual
script has 7 roles)

  I currently use method_missing to pseudo alias is_a_foo to has_role?(foo) explicitly for PT

[% if is_a_admin %] versus [% if has_role admin %], the latter reads smoother for the designer, IMHO.

Maybe to go along with your obj.attr syntax. arryorhash[symbol or number] and foo(symbol or number) ?

Add A Comment: Notepad

Please login


Followup

Message
Date: 2005-07-21 13:29
Sender: Greg Millam

Comparators sound like a good idea. I'll work on this.
Date: 2005-07-21 11:30
Sender: Jeremy Apthorp

Another thing I would like to see is comparisons in if statements.
Like:

[% if user.level > 1 %]

You needn't really go so far as using the whole ruby syntax ([%if
foo.bar[3] === Regexp%] is a bit much) but simple operators like
<, >, <=, >=, != and == would be very useful.
Date: 2005-04-09 09:20
Sender: Greg Millam

Logged In: YES 
user_id=752

I'm still thinking on this. It's almost broaching PageTemplate's
intention of separating design from code.

But aside from that, I'm thinking on how to do it best.

- Greg
Date: 2005-04-03 07:42
Sender: Nobody

Logged In: NO 

are these two items in the works? function args and array/hash
index syntax? looking forward to them. :) thx!

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

Field Old Value Date By
assigned_tobrianwisti2005-04-09 09:21walker
priority52005-03-03 18:56brianwisti
assigned_tonone2005-03-03 18:56brianwisti