pioneer1 Posted February 13, 2014 Share Posted February 13, 2014 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/offeringsHave 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> Link to comment https://forums.phpfreaks.com/topic/286160-how-can-i-get-the-title-and-description-to-the-right-of-the-image/ Share on other sites More sharing options...
afaaro Posted February 13, 2014 Share Posted February 13, 2014 I believe you can style from css like .adsmanager_box_module img { float: left; margin-right: 10px; } something like that Link to comment https://forums.phpfreaks.com/topic/286160-how-can-i-get-the-title-and-description-to-the-right-of-the-image/#findComment-1468702 Share on other sites More sharing options...
pioneer1 Posted February 13, 2014 Author Share Posted February 13, 2014 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 Link to comment https://forums.phpfreaks.com/topic/286160-how-can-i-get-the-title-and-description-to-the-right-of-the-image/#findComment-1468704 Share on other sites More sharing options...
pioneer1 Posted February 13, 2014 Author Share Posted February 13, 2014 I see the 2 cells gets wider as more text are typed in the description. Is there a way to fix the cells of the table not to expand (It must stay the same size) 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> Link to comment https://forums.phpfreaks.com/topic/286160-how-can-i-get-the-title-and-description-to-the-right-of-the-image/#findComment-1468705 Share on other sites More sharing options...
paddy_fields Posted February 13, 2014 Share Posted February 13, 2014 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; } Link to comment https://forums.phpfreaks.com/topic/286160-how-can-i-get-the-title-and-description-to-the-right-of-the-image/#findComment-1468712 Share on other sites More sharing options...
afaaro Posted February 13, 2014 Share Posted February 13, 2014 echo "<br />".substr($row->ad_text,0,50); On line 161 .adsmanager_inner_box tr td { padding-right: 5px; width: 50%; } Link to comment https://forums.phpfreaks.com/topic/286160-how-can-i-get-the-title-and-description-to-the-right-of-the-image/#findComment-1468713 Share on other sites More sharing options...
pioneer1 Posted February 13, 2014 Author Share Posted February 13, 2014 echo "<br />".substr($row->ad_text,0,50); On line 161 .adsmanager_inner_box tr td { padding-right: 5px; width: 50%; } Thanks Afaaro that did the trick. The layout looks right now. Link to comment https://forums.phpfreaks.com/topic/286160-how-can-i-get-the-title-and-description-to-the-right-of-the-image/#findComment-1468716 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.