[Solar-talk] $this->action & images

Jeff Surgeson solar at 3hex.com
Wed May 17 14:20:57 PDT 2006


Hi

Trying to use a image in a action link instead of text, this worked in prev 
solar versions but does not seem possible in current version due to forced 
escaping.

echo $this->action('books/list', $this->image('images/common/button1.jpg')

How do I turn off escaping? or should I write my own helper function?

If I change line 90 in Solar_View_Helper_Action
             
$text = $this->_view->getText($text); 
to
$text = $this->_view->getTextRaw($text);

It works, but how do I tell the action helper to use getTextRaw? you cant can 
you?

Is this not a useful helper or am I the only person still using graphical 
links? ;-)

    public function action($spec, $text = null, $raw=false)
    {
        if ($spec instanceof Solar_Uri_Action) {
            // already an action uri object
            $href = $spec->fetch();
        } else {
            // build-and-fetch the string as an action spec
            $href = $this->_uri->quick($spec);
        }

        // escape the href itself
        $href = $this->_view->escape($href);

        // return the href, or an anchor?
        if (empty($text)) {
            return $href;
        } elseif(!$raw) {
            $text = $this->_view->getText($text);
            return "<a href=\"$href\">$text</a>";
        } elseif($raw) {
            $text = $this->_view->getTextRaw($text);
            return "<a href=\"$href\">$text</a>";
        }
    }

-- 
Jeff Surgeson


More information about the solar-talk mailing list