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

Your code modifications and patches you want to share with others.
Locked
User avatar
Gianmarco Odorizzi
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 3504
Joined: Wed Jun 14, 2006 12:54 pm
Location: Trento
Contact:

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

Post by Gianmarco Odorizzi » Sat Aug 25, 2007 12:40 pm

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

		}

	}

You do not have the required permissions to view the files attached to this post.
Last edited by Gianmarco Odorizzi on Sat Aug 25, 2007 1:00 pm, edited 1 time in total.
It has been more than a long day, but Joomla has survived, and will continue to not just survive but grow even stronger.

ilox - 19 Aug 2007

Gergo Erdosi
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4031
Joined: Sat Nov 11, 2006 9:34 pm
Location: Hungary

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

Post by Gergo Erdosi » Sat Aug 25, 2007 12:47 pm

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.

User avatar
Gianmarco Odorizzi
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 3504
Joined: Wed Jun 14, 2006 12:54 pm
Location: Trento
Contact:

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

Post by Gianmarco Odorizzi » Sat Aug 25, 2007 12:58 pm

sure...see 1st post....
It has been more than a long day, but Joomla has survived, and will continue to not just survive but grow even stronger.

ilox - 19 Aug 2007

User avatar
josey
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 100
Joined: Thu Jan 12, 2006 9:10 pm
Location: Lake Michigan

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

Post by josey » Sat Sep 29, 2007 11:39 pm

Thanks for sharing. This comes in handy.

Cheers.

User avatar
Gianmarco Odorizzi
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 3504
Joined: Wed Jun 14, 2006 12:54 pm
Location: Trento
Contact:

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

Post by Gianmarco Odorizzi » Sun Sep 30, 2007 12:05 am

No problem....it's very useful for SEO :)
It has been more than a long day, but Joomla has survived, and will continue to not just survive but grow even stronger.

ilox - 19 Aug 2007

User avatar
Tonie
Joomla! Master
Joomla! Master
Posts: 16584
Joined: Thu Aug 18, 2005 7:13 am

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

Post by Tonie » Sun Sep 30, 2007 10:10 am

Moving to Joomla! Core Hacks forum

User avatar
davidtowers
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Wed Sep 05, 2007 7:53 am
Contact:

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

Post by davidtowers » Wed Oct 03, 2007 12:37 pm

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
Helping businesses operate more effectively online - http://www.GoodWebPractices.com

User avatar
vist
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 133
Joined: Sun Oct 16, 2005 5:48 pm
Contact:

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

Post by vist » Thu Dec 13, 2007 1:14 pm

joomla 1.0.13

error:


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

mjay212
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri Mar 21, 2008 11:50 pm

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

Post by mjay212 » Sat Mar 22, 2008 12:12 am

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:

Xeonxz
Joomla! Intern
Joomla! Intern
Posts: 99
Joined: Sat Mar 25, 2006 1:01 pm

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

Post by Xeonxz » Sat May 17, 2008 3:05 am

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?
Best Regards
Viktor
3on Webbyrå Stockholm http://www.3on.se
Flighton AB http://www.flighton.se

mjay212
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri Mar 21, 2008 11:50 pm

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

Post by mjay212 » Sun May 18, 2008 11:44 am

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:

Xeonxz
Joomla! Intern
Joomla! Intern
Posts: 99
Joined: Sat Mar 25, 2006 1:01 pm

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

Post by Xeonxz » Mon May 19, 2008 12:02 am

Thank you!! :D
Best Regards
Viktor
3on Webbyrå Stockholm http://www.3on.se
Flighton AB http://www.flighton.se

cyberhost
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Fri Jun 20, 2008 7:24 pm

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

Post by cyberhost » Fri Jun 20, 2008 7:56 pm

Hello Friends

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

Thanks
Please read forum rules regarding signatures: http://forum.joomla.org/viewtopic.php?t=65

724care
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Mon Aug 17, 2009 8:43 pm

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

Post by 724care » Mon Aug 17, 2009 8:57 pm

Thanks for the code. It has fixed my problem.


Locked

Return to “Core Hacks and Patches”