[Solar-talk] creating a link

Paul M Jones pmjones at solarphp.com
Fri Sep 1 14:04:50 PDT 2006


On Sep 1, 2006, at 3:45 PM, Paul M Jones wrote:

>
> 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.

Incidentally, that's for use inside a view script, called via  
Solar_View.  Let me know if that helps you out or not.


--

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