How to make article info appear to the right

Your code modifications and patches you want to share with others.
Locked
marshull
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 137
Joined: Wed Sep 20, 2006 4:23 am

How to make article info appear to the right

Post by marshull » Sat Mar 08, 2008 4:02 pm

I hired out to have someone do some core editing for me. On my site, every article will first have an image, then the article. I didn't like how the article info like Title, Author and Date was appearing above the article. I wanted it to appear to the right of the image. I ended up hiring a gentleman named Andrey. He put together the following hack and documented it for me. I let him know that I wanted to be able to release this hack so that others may benefit from it, so here it is. You can find my site at http://www.daredeviltattoo.com/joomla The press link will take you to the articles.

How to make article info appear to the right of first article image instead of appearing above it.

1. Open the content.html.php file found in /components/com_content folder.

2. Near line 470 find the following text:
---------------
// process the new bots
$_MAMBOTS->loadBotGroup( 'content' );
$results = $_MAMBOTS->trigger( 'onPrepareContent', array( &$row, &$params, $page ), true );
---------------

3. After these lines insert the following:
---------------
// BEGIN HACK
// grab the first image to place before title
?><table class="contentpaneopen<?php echo $params->get( 'pageclass_sfx' ); ?>"><tr><td><?php
$matches = array();
$has_image = preg_match("/\<img [^>]*>/", $row->text, $matches);

if ($has_image) {
// show the image
echo $matches[0];
// remove image from text
$row->text = str_replace($matches[0], '', $row->text);
}
// then show everithing like regular
// END HACK
---------------

4. Scroll down to see the following lines:
---------------
?>
<tr>
<td valign="top" colspan="2">
<?php
// displays Table of Contents
HTML_content::TOC( $row );

// displays Item Text
echo ampReplace( $row->text );
?>
</td>
</tr>
<?php
---------------

5. REPLACE them with the following:
---------------
// BEGIN HACK
// break table to show text outside
?></table><br /><?php

// displays Table of Contents
HTML_content::TOC( $row );

// displays Item Text
echo ampReplace( $row->text );
// END HACK
---------------

Regards,
Andrey (aasfalcon@gmail.com)

otuyelu
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Fri Apr 18, 2008 6:41 pm

Re: How to make article info appear to the right

Post by otuyelu » Wed May 28, 2008 1:32 am

Your site is so customized, hardly any element is in the default Joomla scheme. This is what the Joomla community loves to see, "possibilities!". I also like to thank you for sharing the code with the community.

Thanks

downloadvyp
Joomla! Intern
Joomla! Intern
Posts: 79
Joined: Sat Sep 26, 2009 6:35 pm
Contact:

Re: How to make article info appear to the right

Post by downloadvyp » Sun Apr 11, 2010 3:37 pm

great tutorial.thanks


Locked

Return to “Core Hacks and Patches”