Create Account
/ Reminder
 
 
 

New World Designs
Joomla contentheading H1 with no core Hack
Monday, 28 September 2009 22:01

I have found many people on forums looking for ways to add a hack to the standard Joomla system, to display the article titles as H1 (Header 1) in the source code, without hacking the core system.

 

What many people dont realise is that Joomla 1.5 has an amazing system built into the template structure that allows you to modify core script files without touching the core files. An amazing example of this, is in the Beez template which comes with the standard joomla system, it shows an amazing example of how you can modify most components and modules from the template folder.

templates/beez/html/com_content/article/default.php

If this file exists, it overrides the

components/com_content/views/article/tmpl/default.php

This allows you to customise this file and it wont be over written when you upgrade to the latest Joomla core system.

So basically if you create the file structure in your template folder in the same way they have in the Beez template, it will work fine for you. What i do when producing a custom template is copy and paste the files templates/beez/html/ into my own template, and then modify these files as i need. Joomla will automatically recognise what you have and havent in this folder, you dont need to tell it, as it checks here first. So as soon as you upload this file it will instantly start to use it.

Here is what i have modifed in the above file on lines 20 - 27 (but this may change slightly over time from different release versions).
templates/XXXX/html/com_content/article/default.php

<h1 class="contentheading">
 params->get('link_titles') && $this->article->readmore_link != '') : ?>
 <a href="/" class="contentpagetitle">
  article->title; ?>
   echo $this->escape($this->article->title);
 endif; ?>
</h1>

but i have modified it further by removing the class "contentheading" to get this

<h1>
 
 <a href="/article->readmore_link; ?>" class="contentpagetitle">
  article->title; ?>
   echo $this->escape($this->article->title);
 endif; ?>
</h1>


Which can still be styled with css in the by finding the correct style path.

 

There is more info regarding Template overides here

http://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core

 

I hope this helps
Ian

 

 

Trackback(0)
Comments (3)add comment
...
written by P Denver , April 29, 2010

Thank you this has worked a treat smilies/smiley.gif


...
written by John C , May 29, 2010

Ive been looking everywhere for this, thanks!


...
written by Home Improvement , June 08, 2010

Great thank you, finally found it. lets hope it works



Write comment
smaller | bigger
password
 

busy
 

© 1998 - 2009 New World Designs
Website hosted by New World Hosting Home | Photography | Web Design | Legal Documents | Blog