Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Articles Panel

Asked Modified Viewed 975 times
V
Vyper69
V
Unprecedented Times call for Unprecedented Measures
  • Senior Member, joined since
  • Contributed 551 posts on the community forums.
  • Started 146 threads in the forums
  • Started this discussions
asked
Senior Member

@Craig I know you have already done a articles panel and I use it, but by chance could you please do one like the FP News Panel.

Merged on Nov 06 2012 at 15:41:01:
Ok so I took the original code fom Craig's News Panel, and made changes so it would reflect the Articles. Where am I going wrong.

Here is the only error I get at this point.
Unknown column 'articles_id' in 'field list'


Here is the code:

if (!defined("IN_FUSION")) { die("Access Denied"); }

include LOCALE.LOCALESET."articles_cats.php";

//////////SETTINGS/////////////////////////////////////////////
//Single or double column news 1 == Single || 0 == Double collumn
$single = 0;
// Number of news displayed
$items_per_page = 4;
// Counter for Displaying News in 2 Columns NO NEED TO CHANGE THIS.
$counter = 3;
/////////////SETTINGS END /////////////////////////////////////

   $i = 0;

   if (!isset($_GET['readmore']) || !isnum($_GET['readmore'])) {
   $rows = dbcount("(articles_id)", DB_ARTICLES, groupaccess('articles_visibility')."
                  AND (articles_start='0'||articles_start<=".time().")
                  AND (articles_end='0'||articles_end>=".time().")
                  AND articles_draft='0'");

   if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) { $_GET['rowstart'] = 0; }
   if ($rows) {
   $result = dbquery(
   "SELECT tn.*, tc.*, tu.user_id, tu.user_name, tu.user_status, articles_news
   FROM ".DB_articles." tn
   LEFT JOIN ".DB_USERS." tu ON tn.articles_name=tu.user_id
   LEFT JOIN ".DB_ARTICLES_CATS." tc ON tn.articles_cat=tc.articles_cat_id
   WHERE ".groupaccess('articles_visibility')." AND (articles_start='0'||articles_start<=".time().")
   AND (articles_end='0'||articles_end>=".time().") AND articles_draft='0'
   GROUP BY articles_id
   ORDER BY articles_sticky DESC, articles_datestamp DESC LIMIT ".$_GET['rowstart'].",".$items_per_page
   );

   $numrows = dbrows($result);
   if ($single !=="1") {
   echo "<table valign='top' cellpadding='0' cellspacing='2' width='100%' border='0'>\n<tr>\n";
   }
   while ($data = dbarray($result)) {
   $i++;
   $comments = dbcount("(comment_id)", DB_COMMENTS." WHERE comment_type='N' AND comment_hidden='0' AND comment_item_id='".$data['articles_id']."'");
   $articles_cat_image = "";
   $articles_subject = "<a name='articles_".$data['articles_id']."' id='articles_".$data['articles_id']."'></a>".stripslashes($data['articles_subject']);
   $articles_cat_image = "<a href='".($settings['articles_image_link'] == 0 ? "articles_cats.php?cat_id=".$data['articles_cat'] : BASEDIR."articles.php?readmore=".$data['articles_id'] )."'>";
   if ($data['articles_image_t2'] && $settings['articles_image_frontpage'] == 0) {
   $articles_cat_image .= "<img src='".IMAGES_N_T.$data['articles_image_t2']."' alt='".$data['articles_subject']."' class='articles-category' /></a>";
   } elseif ($data['articles_cat_image']) {
   $articles_cat_image .= "<img src='".get_image("nc_".$data['articles_cat_name'])."' alt='".$data['articles_cat_name']."' class='articles-category' /></a>";
   } else {
   $articles_cat_image = "";
   }
   $articles_articles = $data['articles_breaks'] == "y" ? nl2br(stripslashes($data['articles_articles'])) : stripslashes($data['articles_articles']);

   $articles_info = array(
   "articles_id" => $data['articles_id'], "user_id" => $data['user_id'],
   "user_name" => $data['user_name'], "user_status" => $data['user_status'],
   "articles_date" => $data['articles_datestamp'], "cat_id" => $data['articles_cat'],
   "articles_articles" => $data['articles_articles'], "cat_name" => $data['articles_cat_name'],
   "cat_image" => $articles_cat_image, "articles_subject" => $data['articles_subject'],
   "articles_ext" => $data['articles_extended'] ? "y" : "n", "articles_reads" => $data['articles_reads'],
   "articles_comments" => $comments, "articles_allow_comments" => $data['articlesnews_allow_comments'],
   "articles_sticky" => $data['articles_sticky']
   );
   
   if ($single =="1") {
   echo "<!--articles_prepost_".$i."-->\n";
   render_articles($articles_subject, $articles_articles, $articles_info);
   }else{
   echo "<td style='vertical-align: top; width: 50%;'>\n";
   echo "<!--articles_prepost_".$i."-->\n";
   render_articles($articles_subject, $articles_articles, $articles_info);
   echo "</td>\n";
   if ($counter % 2 == 0){ echo "</tr>\n<tr>\n"; }
   $counter++;
   }
   }
   if ($single !=="1") {
   echo "</tr>\n</table>";
   }
   echo "<!--sub_articles_idx-->\n";

   if ($rows > $items_per_page) echo "<div style='margin-top:5px; text-align: center;'>\n".makepagenav($_GET['rowstart'],$items_per_page,$rows,3)."\n</div><br />\n";
   } else {
   opentable($locale['global_030']);
   echo "<div style='text-align: center;'><br />\n".$locale['global_031']."<br /><br />\n</div>\n";
   closetable();
   }
   }
   
?>


Merged on Nov 06 2012 at 17:11:13:
I am assuming it has to do with the part of the code for articles category image, since that does not exist. Please correct me if I am wrong.
Edited by Vyper69 on 06-11-2012 23:11,
0 replies
There are no post found.

Labels

None yet

Statistics

  • Views 0 views
  • Posts 0 posts
  • Votes 0 votes
  • Topic users 1 member

1 participant

V
V
Unprecedented Times call for Unprecedented Measures
  • Senior Member, joined since
  • Contributed 551 posts on the community forums.
  • Started 146 threads in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet