Browse Items tagged $tag

Hi,

I'm trying to display the tag when it is set in a browse view.

In items/browse.php, I have something like the following:

<h1>Browse Items
<?php
   if (isset($_GET['tags'])) {
       echo ' tagged: '.$_GET['tags'].'';
   }
?>
</h1>

This works while the tag is set in a query string, like...

items/browse?tags=my+tag

But it doesn't work when the URL structure looks like...

items/browse/tag/my+tag

The latter is what is generated by item_tags_as_string().

So my question is how can I grab the tag variable regardless of whether or not it's set in a query string?

Thanks -- Erin

I found a workaround.

Just avoid using item_tags_as_string(). Using the following anywhere tags are shown allows me to retrieve the $tag with the GET method whenever I need it:

<?php echo tag_string(get_current_item(), uri('items/browse?tags=')); ?>

You can get to the "slash" URL parameters with some Zend magic.

The framework mostly assumes you'll be doing the work with parameters in a controller, so the call to get those params is pretty gnarly-looking:

$tag = Zend_Controller_Front::getInstance()->getRequest()->getParam('tag');