Sorry for the newbie question - I'm trying to work out how to rewrite a link at 
the top of a table that sorts the table by column...

At present, I'm using:

<th tal:repeat="item fields">
  <a href="?criteria=${criteria}&amp;column=${repeat/item/key}" 
tal:content="repeat/item/key" >field name</a>

where I've captured incoming values in the GET ...

$template->column   = array_key_exists('column', $_GET)) ? 
htmlspecialchars($_GET['column']) : '';  # grab the sort column
$template->criteria =  (array_key_exists('criteria', $_GET)) ? 
htmlspecialchars($_GET['criteria']) : '';    # grab search criteria

I need to decide how to signify that a table, already sorted by 'column', 
should be reverse sorted by column. In the past I'd do this by using the case 
of 'column' - 'column' for ascending and 'COLUMN' for descending. Is there a 
way to do this without resorting to php? or is there a more idiomatic PHPTAL 
way of doing it?

Any pointers gratefully received...


PHPTAL mailing list

Reply via email to