Page 1 of 1

[LITTLE CORE HACK] How to change content heading to <h1> in

Posted: Sat Aug 25, 2007 12:40 pm
by Gianmarco Odorizzi
Hi!

I just made a little hack in this file:

components/com_content/content.html.php

Alla articles titles will cahnge from to

Note: only tested with Joomla 1.0.12. Make sure you have a backup of you file before aplly the hack

Other versions:


check in this file:

Code: Select all

function Title( &$row, &$params, &$access ) {

		if ( $params->get( 'item_title' ) ) {
			if ( $params->get( 'link_titles' ) && $row->link_on != '' ) {

				?>
				<td class="contentheading<?php echo $params->get( 'pageclass_sfx' ); ?>" width="100%">
					<a href="<?php echo $row->link_on;?>" class="contentpagetitle<?php echo $params->get( 'pageclass_sfx' ); ?>">

						<?php echo $row->title;?></a>

				<?php HTML_content::EditIcon( $row, $params, $access ); ?>
				</td>
				<?php
			} else {
				?>
				<td class="contentheading<?php echo $params->get( 'pageclass_sfx' ); ?>" width="100%">
				<?php echo $row->title;?>
				<?php HTML_content::EditIcon( $row, $params, $access ); ?>
				</td>
				<?php
			}
		} else {
			?>
			<td class="contentheading<?php echo $params->get( 'pageclass_sfx' ); ?>" width="100%">
			<?php HTML_content::EditIcon( $row, $params, $access ); ?>
			</td>
			<?php
		}
	}


an replace with

Code: Select all

unction Title( &$row, &$params, &$access ) {

		if ( $params->get( 'item_title' ) ) {

			if ( $params->get( 'link_titles' ) && $row->link_on != '' ) {

				?>

				<h1>

					<a href="<?php echo $row->link_on;?>" class="contentpagetitle<?php echo $params->get( 'pageclass_sfx' ); ?>">

						<?php echo $row->title;?></a>

					<?php HTML_content::EditIcon( $row, $params, $access ); ?>

				</h1>

				<?php

			} else {

				?>

				<h1>

					<?php echo $row->title;?>

					<?php HTML_content::EditIcon( $row, $params, $access ); ?>

				</h1>

				<?php

			}

		} else {

			?>

			<td class="contentheading<?php echo $params->get( 'pageclass_sfx' ); ?>" width="100%">

				<?php HTML_content::EditIcon( $row, $params, $access ); ?>

			</td>

			<?php

		}

	}


Re: [LITTLE CORE HACK] How to change content heading to <h1>

Posted: Sat Aug 25, 2007 12:47 pm
by Gergo Erdosi
Gianmarco Odorizzi wrote: Note: only tested with Joomla 1.0.12. Make sure you have a backup of you file before aplly the hack
Thanks for sharing this hack! Could you please describe which lines did you modify? This would help for those, who use Joomla 1.0.13 or other 1.0.x Joomla version.

Re: [LITTLE CORE HACK] How to change content heading to <h1>

Posted: Sat Aug 25, 2007 12:58 pm
by Gianmarco Odorizzi
sure...see 1st post....

Re: [LITTLE CORE HACK] How to change content heading to <h1>

Posted: Sat Sep 29, 2007 11:39 pm
by josey
Thanks for sharing. This comes in handy.

Cheers.

Re: [LITTLE CORE HACK] How to change content heading to <h1>

Posted: Sun Sep 30, 2007 12:05 am
by Gianmarco Odorizzi
No problem....it's very useful for SEO :)

Re: [LITTLE CORE HACK] How to change content heading to <h1>

Posted: Sun Sep 30, 2007 10:10 am
by Tonie
Moving to Joomla! Core Hacks forum

Re: [LITTLE CORE HACK] How to change content heading to <h1>

Posted: Wed Oct 03, 2007 12:37 pm
by davidtowers
I am looking for this exact hack but for Joomla 1.5

The problem is that the components/com_content/content.php file does not contain the same content...

Please please please can someone help and provide a simple core hack solution for Joomla 1.5?

Thank you in advance!

David

Re: [LITTLE CORE HACK] How to change content heading to <h1>

Posted: Thu Dec 13, 2007 1:14 pm
by vist
joomla 1.0.13

error:


Warning: Missing argument 5 for HTML_content::show() in xxx/components/com_content/content.html.php on line 771

Re: [LITTLE CORE HACK] How to change content heading to <h1> in

Posted: Sat Mar 22, 2008 12:12 am
by mjay212
Hey everybody!

I was looking for a solution to do this in Joomla 1.5.1.

So I wanted to change all titles into H1 and subtitles into H2

Find this folder:

joomla-site.com/components/com_content/views/

pretty simple, but to do this you have to change all those view templates in above's folders subfolders.

http://www.mfake.de

Means:

joomla-site.com/components/com_content/views/archive/tmpl/default.php
joomla-site.com/components/com_content/views/article/tmpl/default.php
joomla-site.com/components/com_content/views/category/tmpl/default.php
joomla-site.com/components/com_content/views/frontpage/tmpl/default.php
joomla-site.com/components/com_content/views/section/tmpl/default.php

even more files... Just check all the php files that are within the tmpl-folders!
Those files are templates for all the different views.
(actually just look for the class="componentheading, and replace the DIV stuff around it with H1)
Look for this:

Code: Select all

<div class="componentheading<?php echo $this->params->get( 'pageclass_sfx' ); ?>">

</div>
Change those lines into:

Code: Select all

<H1 class="componentheading<?php echo $this->params->get( 'pageclass_sfx' ); ?>">
</H1>

And for including the H2 look for these 2 Lines:

Code: Select all

<td width="60%" valign="top" class="contentdescription<?php echo $this->params->get( 'pageclass_sfx' ); ?>" colspan="2">

	</td>
change them to these two lines:
(actually just look for the class="contentdescription, and replace td stuff around it with H2) 8)

Code: Select all

<H2 class="contentdescription<?php echo $this->params->get( 'pageclass_sfx' ); ?>">

</H2>

Joomla rockz!

Later Martin :eek:

Re: [LITTLE CORE HACK] How to change content heading to <h1> in

Posted: Sat May 17, 2008 3:05 am
by Xeonxz
Hi thx for good help.

Here is my core code from frontend:

Code: Select all

		<td class="contentheading" width="100%">
					Title here			</td>

Note: contentheading and NOT componentheading

Here is code in example code tmpl folder:

Code: Select all

	<td class="contentheading<?php echo $this->params->get( 'pageclass_sfx' ); ?>" width="100%">
		<?php if ($this->params->get('link_titles') && $this->article->readmore_link != '') : ?>
		<a href="<?php echo $this->article->readmore_link; ?>" class="contentpagetitle<?php echo $this->params->get( 'pageclass_sfx' ); ?>">
			<?php echo $this->escape($this->article->title); ?></a>
		<?php else : ?>
			<?php echo $this->escape($this->article->title); ?>
		<?php endif; ?>
	</td>

How do I chane this code? Just change "td" to H1?

Re: [LITTLE CORE HACK] How to change content heading to <h1> in

Posted: Sun May 18, 2008 11:44 am
by mjay212
Hey Bro!

I'm sorry, but it's not just replacing TD with H1, cause the H1 Tag doesn't know the attribute width and
the table requires a td tag for correct markup of table data content.

http://www.track-finder.com

So your new code would be:

Code: Select all

<td class="contentheading<?php echo $this->params->get( 'pageclass_sfx' ); ?>" width="100%">
<H1 class="contentheading<?php echo $this->params->get( 'pageclass_sfx' ); ?>">
      <?php if ($this->params->get('link_titles') && $this->article->readmore_link != '') : ?>
      <a href="<?php echo $this->article->readmore_link; ?>" class="contentpagetitle<?php echo $this->params->get( 'pageclass_sfx' ); ?>">
         <?php echo $this->escape($this->article->title); ?></a>
      <?php else : ?>
         <?php echo $this->escape($this->article->title); ?>
      <?php endif; ?>
</H1>
</td>
Later Martin :eek:

Re: [LITTLE CORE HACK] How to change content heading to <h1> in

Posted: Mon May 19, 2008 12:02 am
by Xeonxz
Thank you!! :D

Re: [LITTLE CORE HACK] How to change content heading to <h1> in

Posted: Fri Jun 20, 2008 7:56 pm
by cyberhost
Hello Friends

Does this hack work for latest release 1.5.3 or is there any change. Anybody tried...

Thanks

Re: [LITTLE CORE HACK] How to change content heading to <h1> in

Posted: Mon Aug 17, 2009 8:57 pm
by 724care
Thanks for the code. It has fixed my problem.