Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to re layout to two col with multi row with MySQL Data

Status
Not open for further replies.

explorer1979

IS-IT--Management
May 16, 2011
9
Hi all,

I am install a Zen Cart

And I am installed the News & Article Management Module
URL on this And it work very good.

Then later I do the forum support research and find how to hack the PHP coding to unlock it just show one record set on
/includes/modules/news_summary.php
I forget on the forum which page. But my coding are base on this and make some layout change/CSS etc.

Now ... I want to layout the news To print out the columns left to right, top to bottom like that order by date or ID
a b
c d
e

Where a is the latest ID or Date (For example, made on today, then b is older and so on etc)


Here are my PHP coding ...


=== BoF PHP ===
PHP:
 <?php

// this query uses part of the original news query, just simplified, if you need different languages that coding needs adding, to alter the amount of stories shown change the limit 5 to number required
$comments = $db->Execute("select n.news_date_published, n.article_id, nt.news_article_name, nt.news_article_shorttext, n.news_image, nt.news_image_text from " . TABLE_NEWS_ARTICLES . " n left join " . TABLE_NEWS_ARTICLES_TEXT . " nt on n.article_id = nt.article_id where n.news_status = '1' order by n.article_id desc limit 5 ");
while (!$comments->EOF)
{
// article_id is used for testing comment out when you ready to send this live
//echo $comments->fields['article_id'];?><br /><span class="articleHeading"><?


echo $comments->fields['news_article_name'];?></span><br /><?
echo strtoupper(zen_date_long($comments->fields['news_date_published']))?>&nbsp;<br />

<?
// get the url for the article and attach to a simple read more link
$articleLink = zen_href_link(FILENAME_NEWS_ARTICLE, 'article_id=' . $comments->fields['article_id']);

// get image for story
if ((zen_not_null($comments->fields['news_image'])) && file_exists(DIR_FS_CATALOG . DIR_WS_IMAGES . $comments->fields['news_image'])) {
$articleImage = zen_image(DIR_WS_IMAGES . $comments->fields['news_image'], $comments->fields['news_image_text'], '', '', 'align="left"');
echo "<a href=" . $articleLink . ">" . $articleImage . "</a>" . "<p style=\"margin-left: 225px;\">" ;
}

echo $comments->fields['news_article_shorttext'];?></p><br /><?

?>
<div class="articleLinkList"><a href="<? echo $articleLink;?> ">Read more</a></div>
<?
// bit of space between articles, if you do this properly with css you can style this better
?><br /><br /><?

$comments->MoveNext();
}
// need to add link to rest of news here if required

?>
=== EoF PHP ===



How to make a table or div to control the layout output like above a b c d e g??

attachment.php


Make like this one
attachment.php


Thank you of your time on reading this and help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top