Zen Cart Logo
Forums / All Other Contributions/Addons / News & Article Management (Output with two column table loop)

News & Article Management (Output with two column table loop)

Views: 486

Results 1 to 2 of 2
11 Oct 2012, 7:42 AM
#1
explorer1979 avatar

explorer1979

Inactive

Join Date:
Jan 2007
Posts:
377
Plugin Contributions:
0

News & Article Management (Output with two column table loop)

Hi all,

I am installed the News & Article Management Module
URL on this http://www.zen-cart.com/downloads.php?do=file&id=791
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

// 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']))?> <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??

Thank you of your time on reading this and help.

Best Regards,
Jimmy Chan
http://explorerhome.dyndns.org/blog

31 Oct 2012, 8:36 AM
#2
explorer1979 avatar

explorer1979

Inactive

Join Date:
Jan 2007
Posts:
377
Plugin Contributions:
0

Re: News & Article Management (Output with two column table loop)

Before (By above coding)
Attachment 11378
After (I want to be like this)
Attachment 11379

Anyone can help? I am try Google many Table or UL, LI layout also don't know how to do the layout like the image above.