[Solar-talk] meta head tags / anchorImage

Jeff Surgeson solar at 3hex.com
Mon Jul 24 02:33:40 PDT 2006


Hi Paul

Two things I have noticed, I am sure that you are aware of it and just working 
on more important stuff, anyway there does not appear to be a way to add 
additional attributes to the anchor tab in your anchorImage helper, only to 
the image. I needed to specify a target attribute but could not, I made the 
following changes to your helper to sort it.

public function anchorImage($spec, $src, $anchor_attribs = array(), $attribs = 
array())
    {
        if ($spec instanceof Solar_Uri) {
            // fetch the full href, not just the path/query/fragment
            $href = $spec->fetch(true);
        } else {
            $href = $spec;
        }

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

        // get the <img /> tag
        $img = $this->_view->image($src, $attribs);

	// add the anchor attribs
        $attr = $this->_view->attribs($anchor_attribs);

        // done!
        return "<a href=\"$href\"$attr>$img</a>";

    }

Secondly you have added all those lovely meta helpers but appear to have 
forgotten to put something in the _head partial template to load them, I have 
this in my _head in place of your /** @todo meta */ :-)

// meta tags, description & keywords
if (! empty($this->layout_meta)) {
    foreach ((array) $this->layout_meta as $key => $val) {
        echo "\t" . $this->Meta($val) . "\n";
    }
}

It will have to be  to include all the meta helpers as you have broken them 
down, I just specify details in the array passed to it so do all 3 on one.

-- 
Jeff Surgeson


More information about the solar-talk mailing list