abcohen
08-19-2005, 05:04 PM
So you want to open the read more in a popup window...
First we'll have to create a new file in the p2_news folder in the plugins directory...
lets call the file poparticle.php
inside that file you'll place this code....
<?php
// +---------------------------------------------+
// | * * Copyright © 2003 – 2005 Subdreamer, LLC |
// | * * http://www.subdreamer.com * * * * * * * |
// | * * This file may not be redistributed. * * |
// +---------------------------------------------+
error_reporting(E_ALL & ~E_NOTICE);
define('IN_SUBDREAMER', true);
$rootpath = "../../";
// ########################### LOAD SUBDREAMER CORE ############################
include($rootpath . 'includes/core.php');
// ############################ LOAD MAIN SETTINGS #############################
$getmainsettings = $DB->query("SELECT varname, value FROM " . TABLE_PREFIX . "mainsettings");
for($i = 0; $setting = $DB->fetch_array($getmainsettings); $i++)
{
*$mainsettings[$setting['varname']] = $setting['value'];
}
// ######################## ARTICLE BITFIELD SETTINGS ##########################
$p2_articlebitfield = array('useglobalsettings' * * * => 1,
* * * * * * * * * * * * * *'displayonline' * * * * * => 2,
* * * * * * * * * * * * * *'displaytitle' * * * * * *=> 4,
* * * * * * * * * * * * * *'displayauthor' * * * * * => 8,
* * * * * * * * * * * * * *'displaycreateddate' * * *=> 16,
* * * * * * * * * * * * * *'displayupdateddate' * * *=> 32,
* * * * * * * * * * * * * *'displayprintarticlelink' => 64,
* * * * * * * * * * * * * *'displayemailarticlelink' => 128,
* * * * * * * * * * * * * *'displaydescription' * * *=> 256,
* * * * * * * * * * * * * *'displaysmilies' * * * * *=> 512,
* * * * * * * * * * * * * *'displaycomments' * * * * => 1024);
// ############################## DISPLAY ARTICLE ##############################
function p2_PopArticle($article)
{
*global $DB, $p2_articlebitfield;
*// get news language
*$p2_language = GetLanguage(2);
*echo '<html>
* * * *<head>
* * * * *<title>' . $article['title'] . '</title>
* * * *</head>
* * * *<body>';
*// display title?
*if($article['settings'] & $p2_articlebitfield['displaytitle'])
*{
* *echo '<b>' . $article['title'] . '</b>';
*}
*// display author?
*if($article['settings'] & $p2_articlebitfield['displayauthor'])
*{
* *echo '<br />' . $p2_language['by'] . ' ' . $article['author'];
*}
*// display published date?
*if($article['settings'] & $p2_articlebitfield['displaycreateddate'])
*{
* *echo '<br />' . $p2_language['published'] . ' ' . iif($article['datestart'] != 0, DisplayDate($article['datestart']), DisplayDate($article['datecreated']));
*}
*// display updated date?
*if( ($article['settings'] & $p2_articlebitfield['displayupdateddate']) AND ($article['dateupdated'] != 0) )
*{
* *echo '<br />' . $p2_language['updated'] . ' ' . DisplayDate($article['dateupdated']);
*}
*// display description?
*if($article['settings'] & $p2_articlebitfield['displaydescription'])
*{
* *if(strlen($article['description']))
* *{
* * *echo '<br /><br />' . iif($article['settings'] & $p2_articlebitfield['displaysmilies'], AddSmilies($article['description']), $article['description']);
* *}
*}
*// print article
*echo '<br /><br />' . str_replace('{pagebreak}', '', $article['article']);
}
// ############################ START POP ARTICLE ############################
if( (isset($_GET['p2_articleid'])) AND (ereg("^[0-9]+$", $_GET['p2_articleid'])) AND ($article = $DB->query_first("SELECT * FROM " . TABLE_PREFIX . "p2_news WHERE articleid = '" . $_GET['p2_articleid'] . "' AND (settings & 2)")) )
{
*// get global article settings
*$getsettings = $DB->query("SELECT description, value FROM " . TABLE_PREFIX . "pluginsettings WHERE pluginid = 2");
*for($i = 0; $setting = $DB->fetch_array($getsettings); $i++)
*{
* *$settings[$setting['description']] = $setting['value'];
*}
*// create global settings
*$globalsettings = 0;
*$globalsettings += $settings['Display Title'] * * * * * * * * * * *== 1 ? 4 * *: 0;
*$globalsettings += $settings['Display Author'] * * * * * * * * * * == 1 ? 8 * *: 0;
*$globalsettings += $settings['Display Creation Date'] * * * * * * *== 1 ? 16 * : 0;
*$globalsettings += $settings['Display Updated Date'] * * * * * * * == 1 ? 32 * : 0;
*$globalsettings += $settings['Display Print Article Link'] * * * * == 1 ? 64 * : 0;
*$globalsettings += $settings['Display Email Article Link'] * * * * == 1 ? 128 *: 0;
*$globalsettings += $settings['Display Description Inside Article'] == 1 ? 256 *: 0;
*$globalsettings += $settings['Display Smilie Images'] * * * * * * *== 1 ? 512 *: 0;
*$globalsettings += $settings['Display User Comments'] * * * * * * *== 1 ? 1024 : 0;
*// use global settings for this article?
*if($article['settings'] & $p2_articlebitfield['useglobalsettings'])
*{
* *$article['settings'] = $globalsettings;
*}
*p2_PopArticle($article);
}
?>
then you'll need to link to that new display code...
in news.php.
On line 406:
* *echo ' <a href="' . RewriteLink('index.php?categoryid=' . $categoryid . '&p2_articleid=' . $article['articleid']) . '">' . $p2_language['read_more'] . '</a>';
Change it to:
echo " <a href=\"#\" onclick=\"window.open('" . $sdurl . "plugins/p2_news/poparticle.php?p2_articleid=" . $article['articleid'] . "', '_blank', ' width=450,height=600,toolbar=0,menubar=0,resizable =0,location=0,status=0,scrollbars=0,directories=0 ');return false\">" . $p2_language['read_more'] . "</a>";
There ya go! this tutorial will allow a user to create the read more link to create a pop window with just the article itself.
***NOTE: this is only ment for an original news plugin (Not a cloned one)!! It will work cloned, when this code is placed before a clone is made.
Attached below you'll find the file -- just incase you're having copy and paste issues (or are just too lazy) :P
First we'll have to create a new file in the p2_news folder in the plugins directory...
lets call the file poparticle.php
inside that file you'll place this code....
<?php
// +---------------------------------------------+
// | * * Copyright © 2003 – 2005 Subdreamer, LLC |
// | * * http://www.subdreamer.com * * * * * * * |
// | * * This file may not be redistributed. * * |
// +---------------------------------------------+
error_reporting(E_ALL & ~E_NOTICE);
define('IN_SUBDREAMER', true);
$rootpath = "../../";
// ########################### LOAD SUBDREAMER CORE ############################
include($rootpath . 'includes/core.php');
// ############################ LOAD MAIN SETTINGS #############################
$getmainsettings = $DB->query("SELECT varname, value FROM " . TABLE_PREFIX . "mainsettings");
for($i = 0; $setting = $DB->fetch_array($getmainsettings); $i++)
{
*$mainsettings[$setting['varname']] = $setting['value'];
}
// ######################## ARTICLE BITFIELD SETTINGS ##########################
$p2_articlebitfield = array('useglobalsettings' * * * => 1,
* * * * * * * * * * * * * *'displayonline' * * * * * => 2,
* * * * * * * * * * * * * *'displaytitle' * * * * * *=> 4,
* * * * * * * * * * * * * *'displayauthor' * * * * * => 8,
* * * * * * * * * * * * * *'displaycreateddate' * * *=> 16,
* * * * * * * * * * * * * *'displayupdateddate' * * *=> 32,
* * * * * * * * * * * * * *'displayprintarticlelink' => 64,
* * * * * * * * * * * * * *'displayemailarticlelink' => 128,
* * * * * * * * * * * * * *'displaydescription' * * *=> 256,
* * * * * * * * * * * * * *'displaysmilies' * * * * *=> 512,
* * * * * * * * * * * * * *'displaycomments' * * * * => 1024);
// ############################## DISPLAY ARTICLE ##############################
function p2_PopArticle($article)
{
*global $DB, $p2_articlebitfield;
*// get news language
*$p2_language = GetLanguage(2);
*echo '<html>
* * * *<head>
* * * * *<title>' . $article['title'] . '</title>
* * * *</head>
* * * *<body>';
*// display title?
*if($article['settings'] & $p2_articlebitfield['displaytitle'])
*{
* *echo '<b>' . $article['title'] . '</b>';
*}
*// display author?
*if($article['settings'] & $p2_articlebitfield['displayauthor'])
*{
* *echo '<br />' . $p2_language['by'] . ' ' . $article['author'];
*}
*// display published date?
*if($article['settings'] & $p2_articlebitfield['displaycreateddate'])
*{
* *echo '<br />' . $p2_language['published'] . ' ' . iif($article['datestart'] != 0, DisplayDate($article['datestart']), DisplayDate($article['datecreated']));
*}
*// display updated date?
*if( ($article['settings'] & $p2_articlebitfield['displayupdateddate']) AND ($article['dateupdated'] != 0) )
*{
* *echo '<br />' . $p2_language['updated'] . ' ' . DisplayDate($article['dateupdated']);
*}
*// display description?
*if($article['settings'] & $p2_articlebitfield['displaydescription'])
*{
* *if(strlen($article['description']))
* *{
* * *echo '<br /><br />' . iif($article['settings'] & $p2_articlebitfield['displaysmilies'], AddSmilies($article['description']), $article['description']);
* *}
*}
*// print article
*echo '<br /><br />' . str_replace('{pagebreak}', '', $article['article']);
}
// ############################ START POP ARTICLE ############################
if( (isset($_GET['p2_articleid'])) AND (ereg("^[0-9]+$", $_GET['p2_articleid'])) AND ($article = $DB->query_first("SELECT * FROM " . TABLE_PREFIX . "p2_news WHERE articleid = '" . $_GET['p2_articleid'] . "' AND (settings & 2)")) )
{
*// get global article settings
*$getsettings = $DB->query("SELECT description, value FROM " . TABLE_PREFIX . "pluginsettings WHERE pluginid = 2");
*for($i = 0; $setting = $DB->fetch_array($getsettings); $i++)
*{
* *$settings[$setting['description']] = $setting['value'];
*}
*// create global settings
*$globalsettings = 0;
*$globalsettings += $settings['Display Title'] * * * * * * * * * * *== 1 ? 4 * *: 0;
*$globalsettings += $settings['Display Author'] * * * * * * * * * * == 1 ? 8 * *: 0;
*$globalsettings += $settings['Display Creation Date'] * * * * * * *== 1 ? 16 * : 0;
*$globalsettings += $settings['Display Updated Date'] * * * * * * * == 1 ? 32 * : 0;
*$globalsettings += $settings['Display Print Article Link'] * * * * == 1 ? 64 * : 0;
*$globalsettings += $settings['Display Email Article Link'] * * * * == 1 ? 128 *: 0;
*$globalsettings += $settings['Display Description Inside Article'] == 1 ? 256 *: 0;
*$globalsettings += $settings['Display Smilie Images'] * * * * * * *== 1 ? 512 *: 0;
*$globalsettings += $settings['Display User Comments'] * * * * * * *== 1 ? 1024 : 0;
*// use global settings for this article?
*if($article['settings'] & $p2_articlebitfield['useglobalsettings'])
*{
* *$article['settings'] = $globalsettings;
*}
*p2_PopArticle($article);
}
?>
then you'll need to link to that new display code...
in news.php.
On line 406:
* *echo ' <a href="' . RewriteLink('index.php?categoryid=' . $categoryid . '&p2_articleid=' . $article['articleid']) . '">' . $p2_language['read_more'] . '</a>';
Change it to:
echo " <a href=\"#\" onclick=\"window.open('" . $sdurl . "plugins/p2_news/poparticle.php?p2_articleid=" . $article['articleid'] . "', '_blank', ' width=450,height=600,toolbar=0,menubar=0,resizable =0,location=0,status=0,scrollbars=0,directories=0 ');return false\">" . $p2_language['read_more'] . "</a>";
There ya go! this tutorial will allow a user to create the read more link to create a pop window with just the article itself.
***NOTE: this is only ment for an original news plugin (Not a cloned one)!! It will work cloned, when this code is placed before a clone is made.
Attached below you'll find the file -- just incase you're having copy and paste issues (or are just too lazy) :P