Page 1 of 1

'Back to category' link in H1 tags

Posted: Wed Mar 23, 2011 10:11 am
by Dave Everitt
In an earlier version of Joomla 1.6 I made the h1 heading text into a link back to the parent page by hacking (and I use the word advisedly because it was done something like 'try this, then this... it works'):
/component/com_content/views/article/tmpl/default.php
to include $this->parent like this:

Code: Select all

<h1>
  <?php
  echo '<a href="' . JRoute::_(ContentHelperRoute::getArticleRoute($this->parent)) . '">';
  echo $this->escape($this->params->get('page_heading')) . '</a>';
  ?>
</h1>
Which works fine on that installation, but we just made the site live site with a more recent version of Joomla 1.6, and the same solution produces an empty ?id= on the end of the URL generated by that code.

Here's the test site with a working version of the h1 link...

...and here's the same page on the live site where the identical hack yielded an empty id on the end of URL. For now, I've got around it with:

Code: Select all

str_replace("?id=", "", JRoute::_(ContentHelperRoute::getArticleRoute($this->parent)))
but I'd welcome suggestions to improve this, or a way to handle it from the admin.