PDA

View Full Version : Modify News Archive Plugin to extract data from cloned news plugin


jennec
12-02-2005, 04:29 PM
Changing the News Article plugin to view your cloned news plugin.

Before you start modifying code you will need to know what the plugin ID is of your cloned news plugin. If it is the first cloned plugin you have then it will be P2000, any futher cloned plugins will have ids beginning P2001 and P2002 and so on. For this tutorial we will presume that the cloned plugin ID is P2000

Open the News Archive php file \\sdpath\plugins\p20_news_archive\p20_archive. php

Find the following code on line 32

**$getarticles = $DB->query("SELECT articleid, categoryid, title, author, IF ( n.dateupdated = 0, n.datecreated, n.dateupdated ) as date
**************************** FROM " . TABLE_PREFIX . "p2_news n
**************************** WHERE (n.settings & 2)
**************************** ORDER BY IF ( n.dateupdated = 0, n.datecreated, n.dateupdated ) DESC LIMIT $start, " . ($limit + 1) . "");
And replace with

**$getarticles = $DB->query("SELECT articleid, categoryid, title, author, IF ( n.dateupdated = 0, n.datecreated, n.dateupdated ) as date
**************************** FROM " . TABLE_PREFIX . "p2000_news n
**************************** WHERE (n.settings & 2)
**************************** ORDER BY IF ( n.dateupdated = 0, n.datecreated, n.dateupdated ) DESC LIMIT $start, " . ($limit + 1) . "");
Fine the following code on line 51

******if($newsplugin = $DB->query_first("SELECT displayorder FROM " . TABLE_PREFIX . "pagesort WHERE categoryid = '" . $article['categoryid'] . "' AND pluginid = '2'") )
and replace with

******if($newsplugin = $DB->query_first("SELECT displayorder FROM " . TABLE_PREFIX . "pagesort WHERE categoryid = '" . $article['categoryid'] . "' AND pluginid = '2000'") )
Find the following code on line 53

********echo '<td style="padding-bottom: 5px;" valign="top"><a href="' . RewriteLink('index.php?categoryid=' . $article['categoryid'] . '&p2_articleid=' . $article['articleid']) . '">' . $article['title'] . '</a></td>';
and replace with

********echo '<td style="padding-bottom: 5px;" valign="top"><a href="' . RewriteLink('index.php?categoryid=' . $article['categoryid'] . '&p2000_articleid=' . $article['articleid']) . '">' . $article['title'] . '</a></td>';

Robert_J_Ellis
01-30-2006, 02:58 PM
I had'nt even seen this, very handy. Thanks Jennec :)

kushaaal
02-01-2006, 05:33 PM
I could not get the hang of it! Kindly eloborate

jennec
02-03-2006, 03:28 PM
<div class='quotetop'>QUOTE(Dr. Kushal Pathak &#064; Feb 1 2006, 06&#58;33 PM) 3579</div>
I could not get the hang of it&#33; Kindly eloborate
[/b]

Can you elaborate where you are having trouble?

kushaaal
02-03-2006, 06:37 PM
Well I didnt read the topic title. It will be handy. Is there any way News Archive can be configured to show specific category of news where it has been posted.
I use a same news plugin to post to different categories. Now in the particular category page, I want to provide a link for news archive for that category only.
Can the News archive category cloned, and be made to work the way I want?
Regards,