'Back to category' link in H1 tags

Everything to do with Joomla! 2.5 templates and templating.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Dave Everitt
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Sat Mar 19, 2011 2:44 pm

'Back to category' link in H1 tags

Postby Dave Everitt » Wed Mar 23, 2011 10:11 am

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.

Return to “Templates for Joomla! 2.5”

Who is online

Users browsing this forum: No registered users and 4 guests