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>';
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>';