Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Navigation
Latest Addons
AD Gallery 43
SyntaxHighlighte... 48
Newsletters v4.03 106
Facebook Like Box 119
Newsletters v4.02 56
Metro 153
Facebook Connect 164
Shoutbox Panel 124
Redactor for PHP... 103
MI Floating Side... 106
Facebook Login/R... 147
Avatar Studio v2.03 177
Relationship Sta... 96
Sexual Orientati... 113
Fisherman 140
Popular Addons
iTheme2 5794
Arise 5783
User Control v1.23 4615
Event Calendar 4045
Photowidget panel 3881
Radio-Theme red2... 3349
Highslide Gallery 3311
CSS/JavaScript D... 3223
Facebook Connect... 2979
Dynamic Menu 2889
Slideshow Lightb... 2718
L-AMANT 2656
Enigma 2629
2Dark 2603
Black 2569
View Thread
Who is here? 1 guest(s)
 Print Thread
Adding Article Categories Panel
cybernie
Hi!

I am working a website and I need a little help on adding the Article Categories on the center panel. I can successfully put in on the main page by setting it as Opening site page via the Main settings but it's not the setup that I want for my site.

I want my site opening page to be the news.php and below it is a panel displaying the articles categories. I can't find the right infusion for it to make my intended layout work.

Can someone led me a hand on this. Thanks in advance.
 
skpacman
Make a new panel in the upper center or lower center with the following in the "Panel Code" box.

Download source  Code
//ORIGINAL CODE BY NICK JONES
//CODE FROM ARTICLES.PHP
//ADAPTED TO LIST IN PANEL BY skpacman

include LOCALE.LOCALESET."articles.php";
   opentable($locale['400']);
   echo "<!--pre_article_idx-->\n";
   
   //$result = dbquery("SELECT article_cat_id, article_cat_name, article_cat_description FROM ".DB_ARTICLE_CATS." WHERE ".groupaccess('article_cat_access')." ORDER BY article_cat_name");
   
   // NEW QUERY
   $result = dbquery(
      "SELECT ac.article_cat_id, ac.article_cat_name, ac.article_cat_description, COUNT(a.article_cat) AS article_count FROM ".DB_ARTICLES." a
      LEFT JOIN ".DB_ARTICLE_CATS." ac ON a.article_cat=ac.article_cat_id
      WHERE ".groupaccess('ac.article_cat_access')."
      GROUP BY ac.article_cat_id
      ORDER BY ac.article_cat_name"
   );
      
   $rows = dbrows($result);
   if ($rows) {
      $counter = 0; $columns = 2;
      echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
      while ($data = dbarray($result)) {
         if ($counter != 0 && ($counter % $columns == 0)) { echo "</tr>\n<tr>\n"; }
         //$num = dbcount("(article_cat)", DB_ARTICLES, "article_cat='".$data['article_cat_id']."' AND article_draft='0'");
         echo "<td valign='top' width='50%' class='tbl article_idx_cat_name'><!--article_idx_cat_name--><a href='/articles.php?cat_id=".$data['article_cat_id']."'>".$data['article_cat_name']."</a> <span class='small2'>(".$data['article_count'].")</span>";
         if ($data['article_cat_description'] != "") { echo "<br />\n<span class='small'>".$data['article_cat_description']."</span>"; }
         echo "</td>\n";
         $counter++;
      }
      echo "</tr>\n</table>\n";
   } else {
      echo "<div style='text-align:center'><br />\n".$locale['401']."<br /><br />\n</div>\n";
   }
   echo "<!--sub_article_idx-->\n";
   closetable();




in the box below it, add the following line:
Download source  Code
/news.php




And click the "Include on these pages" radio button.

Save the panel, enable in panel admin and now you have a list of articles on your news page.
 
http://www.php-fusion.us
cybernie
Thank you so much. I finally made it work the way I intended it to.

Is there way to make the News Categories clickable?

news_cats.php by default displays all the categories with the links to posted news on the side. What I want is for the new categories to look like the Article Categories that is just showing all the categories and when you click a certain new category it gives you the list of all the posted news.
Edited by cybernie on 20-05-2012 07:34
 
skpacman
That wouldn't be possible unless you edit core files or make a custom .php for news categories.

I'm booked on projects right now or I would attempt to make one for you.
 
http://www.php-fusion.us
cybernie
I see. I hope someone here could help me on this Grin

Merged on Jun 19 2012 at 08:19:36:
Hi! It's me once again. Sorry for bumping up my post but I got another question.

How can I display the article category name in bold? I tried it at the theme.php but it did not work.
Edited by cybernie on 19-06-2012 08:19
 
Jump to Forum:
Similar Threads
Thread Forum Replies Last Post
Link panel to another subdomain Content Administration 3 19-05-2013 08:50
Stop Forum Spam Panel Official releases [Panels] 14 12-05-2013 19:51
edit login side panel. Content Administration 3 10-05-2013 18:45
Theme Control Panel Content Administration 2 08-05-2013 13:19
Add buttons to login panel Content Administration 3 06-05-2013 19:24
Official Home of PHP-Fusion uses cookies. Some may already have been set. Read more about our Cookies here.
Please click the button I Consent Cookies to hide this bar and accept our cookies. If you continue to use the site with no action taken, we'll assume that you consent our cookies anyway.
Cookiebar Panel byVenue