I've got it to work with: <th tal:repeat="item fields"> <a href="?criteria=${criteria}&column=${ php: column == repeat.item.key ? strtoupper( repeat.item.key ) : repeat.item.key }" tal:content="repeat/item/key" >field name</a> </th>
but I was wondering if there's something more idiomatic that I should have used instead? dd On 30 Jul 2010, at 16:47, Richard Dyce wrote: > Apologies for double-post - did a reply to a previous posting rather than > start new thread. Sorry! > > Hi, > > 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}&column=${repeat/item/key}" > tal:content="repeat/item/key" >field name</a> > </th> > > 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... > > dd > _______________________________________________ > 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