Jump to content

How can I get the title and description to the right of the image?


Go to solution Solved by pioneer1,

Recommended Posts

Hi,

 

How can I get the title and description to the right of the image? So the image will be left in cell and title and description next to the image in the next cell.

ben-ct.co.za/ben-bank/offerings

Have a look at the attached image. Thank you

 

Here is the code below

function displayContents($contents,$nbimages) {
		$configurationmodel	=$this->getModel( "configuration" );
		$conf = $configurationmodel->getConfiguration();
	?>
		<h1 class="contentheading"><?php echo JText::_('ADSMANAGER_LAST_ADS');?></h1>
		<div class='adsmanager_box_module' align="center">
			<table class='adsmanager_inner_box' width="100%">
			<?php
			$nb_cols = $conf->nb_last_cols;
			$col = 0;
			foreach($contents as $row) {
				if ($col == 0) 
					echo '<tr align="center">';
				$col++;
			?>
				<td>
 
				<?php	
				$linkTarget = TRoute::_("index.php?option=com_adsmanager&view=details&id=".$row->id."&catid=".$row->catid);			
				if (isset($row->images[0])) {
					echo "<div align='center'><a href='".$linkTarget."'><img src='".$this->get('baseurl')."/images/com_adsmanager/ads/".$row->images[0]->thumbnail."' alt='".htmlspecialchars($row->ad_headline)."' border='0' /></a>";
				} else if ($conf->nb_images > 0) {
					echo "<div align='center'><a href='".$linkTarget."'><img src='".ADSMANAGER_NOPIC_IMG."' alt='nopic' border='0' /></a>"; 
				} 	
 
				echo "<br /><a href='$linkTarget'>".$row->ad_headline."</a>"; 
 
                                   //echo "<br />".$row->ad_headline.""; 
                                   echo "<br />".$row->ad_text."";
 
 
				echo "<br /><span class=\"adsmanager_cat\">(".htmlspecialchars($row->parent)." / ".htmlspecialchars($row->cat).")</span>";
				//echo "<br />".$this->reorderDate($row->date_created);
				echo "</div>";
				?>
				</td>
			<?php
				if ($col == $nb_cols) {
					echo "</tr>";
					$col = 0;	
				}
			}
			if ($col != 0) {
				echo "</tr>";
			}
			?>
			</table>

post-167580-0-62975700-1392285616_thumb.jpg

I believe you can style from css like

 

.adsmanager_box_module img {

        float: left;

        margin-right: 10px;

}

 

something like that

 

Thank you for answer afaaro, 

 

I tried it and it worked. Thanks for the great tip :)

I see the 2 cells gets wider as more text are typed in the description.

 

  1. Is there a way to fix the cells of the table not to expand (It must stay the same size)
  2. how can the description amount of text be limited e.g. 50 characters. (Maybe wrap the description text when it reaches edge of cell in table)

Here is the code

echo "<br />".$row->ad_text."";

Thank you

function displayContents($contents,$nbimages) {
		$configurationmodel	=$this->getModel( "configuration" );
		$conf = $configurationmodel->getConfiguration();
	?>
		<h1 class="contentheading"><?php echo JText::_('ADSMANAGER_LAST_ADS');?></h1>
		<div class='adsmanager_box_module' align="center">
			<table class='adsmanager_inner_box' width="100%">
			<?php
			$nb_cols = $conf->nb_last_cols;
			$col = 0;
			foreach($contents as $row) {
				if ($col == 0) 
					echo '<tr align="center">';
				$col++;
			?>
				<td>
 
				<?php	
				$linkTarget = TRoute::_("index.php?option=com_adsmanager&view=details&id=".$row->id."&catid=".$row->catid);			
				if (isset($row->images[0])) {
					echo "<div align='center'><a href='".$linkTarget."'><img src='".$this->get('baseurl')."/images/com_adsmanager/ads/".$row->images[0]->thumbnail."' alt='".htmlspecialchars($row->ad_headline)."' border='0' /></a>";
				} else if ($conf->nb_images > 0) {
					echo "<div align='center'><a href='".$linkTarget."'><img src='".ADSMANAGER_NOPIC_IMG."' alt='nopic' border='0' /></a>"; 
				} 	
 
				echo "<br /><a href='$linkTarget'>".$row->ad_headline."</a>"; 
 
                                   //echo "<br />".$row->ad_headline.""; 
                                   echo "<br />".$row->ad_text."";
 
 
				echo "<br /><span class=\"adsmanager_cat\">(".htmlspecialchars($row->parent)." / ".htmlspecialchars($row->cat).")</span>";
				//echo "<br />".$this->reorderDate($row->date_created);
				echo "</div>";
				?>
				</td>
			<?php
				if ($col == $nb_cols) {
					echo "</tr>";
					$col = 0;	
				}
			}
			if ($col != 0) {
				echo "</tr>";
			}
			?>
			</table>
Edited by pioneer1

This should be in the CSS forum, but neverless you need to use the width property on the 'td' of the HTML table.

.adsmanager_inner_box td {

width: 100px;

} 
Edited by paddyfields
  • Solution

 

echo "<br />".substr($row->ad_text,0,50);

 

On line 161  

 

.adsmanager_inner_box tr td {
  1. padding-right: 5px;
  2. width: 50%;

 

 

Thanks Afaaro that did the trick. The layout looks right now.

Edited by pioneer1
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.