Jump to content

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


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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.