|
An annoying restriction of the Joomla! framework: in full article view the component header disappears.
To get around it we used to create modules turned on just for that specific menu item - this becomes rather tedious.
So, here is a simple hack to add an extra item_header to an article, which shows up in full view only.
We have to modify only two files:
- /components/com_content/content.php
- /administrator/components/com_content/content.xml
You can set item_header in the Content Item Edit window (Parameters Tab).
It gets styled by .componentheading.
content.php:
find line 1591, which looks like:
// if a popup item (e.g. print page) set popup param to correct value
if ( $pop ) {
$params->set( 'popup', 1 );
}
right below, add the following snippet:
// R3D Hack - Writes a title header that shows only in full article view
echo '<div class="componentheading'. $params->get( 'pageclass_sfx' ) .'">'. $params->get( 'item_header' ) .'</div>';
// HACK R3D end
That's it for this file.
Now let's change our backend XML file:
content.xml:
on line 13 you will see:
<param name="item_header" type="text" size="35" default="" label="Titel Header" description="A titel header that shows only in full article view" />
again, add below this line:
<param name="pageclass_sfx" type="text" size="20" default="" label="Page Class Suffix" description="A suffix to be applied to the css classes of the page, this allows individual page styling" />
<param name="@spacer" type="spacer" default="" label="" description="" />
The second param is optional - it adds a space below...
|