[Solar-talk] creating a link

Paul M Jones pmjones at solarphp.com
Fri Sep 1 13:45:50 PDT 2006


On Sep 1, 2006, at 2:15 PM, Ben Barringer wrote:

> What is the best way in solar to create a link like this:
>
> <a href="#" onclick="javascript:alert('hello');">hello</a>
>

YOu can use a helper for that:

<?php echo $this->anchor('#', 'hello', array('onclick' =>  
"javascript:alert('hello')")) ?>

Yeah it's long :-( but it properly escapes everything for you  
automatically.



--

Paul M. Jones  <http://paul-m-jones.com>

Solar: Simple Object Library and Application Repository
for PHP5.   <http://solarphp.com>

Savant: The simple, elegant, and powerful solution for
templates in PHP.   <http://phpsavant.com>




More information about the solar-talk mailing list