View Full Version : "[read more..]" in popup-window?
Like the title says: I want the article after clicking the "read more.."-link to open in a new pop-up window.
How can this be done?
Thanks!
I was told to post here instead of the forums on subdreamer.com - I really need a solution for this... :(
abcohen
08-15-2005, 04:04 PM
I'll start looking into this...
Hug_It
08-16-2005, 04:57 PM
The simplest way to do this would to just add a "target=_blank" to the read more link 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="' . RewriteLink('index.php?categoryid=' . $categoryid . '&p2_articleid=' . $article['articleid']) . '" target=\"_blank\">' . $p2_language['read_more'] . '</a>';
Or did you just want the article to show up?
abcohen
08-16-2005, 06:46 PM
see I would have added a javascript popup code instead of the the blank window...
echo '<a href="#" onclick="javascript:window.open(' . RewriteLink('index.php?categoryid=' . $categoryid . '&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>';
Hug_It
08-16-2005, 07:06 PM
That's cuz you know what you are doing and aren't lazy like me :D
abcohen
08-16-2005, 07:22 PM
Originally posted by Hug_It@Aug 16 2005, 03:06 PM
That's cuz you know what you are doing and aren't lazy like me* :D
705
now...now... you did actually look into the code to find the line to edit (its more then I can say I did for this case sooo far) :P
so actually you're doing a better job then I did -- I just gave one more advanced step [but I'm not sure if I have forward slashed those lines correctly -- so it might need a little play]
vista
08-16-2005, 10:40 PM
Am I the only one that wants to be sure that 100% of the visitors to my sites can view the content?
I'm talking about using javascript, without a <noscript> option, to open a window for a link to site critical information. According to TheCounter.com http://www.thecounter.com/stats/2005/July/javas.php
JavaScript Stats
Fri Jul 1 00:03:01 2005 - Sun Jul 31 23:58:40 2005** 31.0 Days
Javascript 1.2+: 65515575 (89%)
Javascript <1.2: 223054 (0%)
Javascript false: 7686040 (10%)
And, 10% actually higher than I would have guessed as an overall number in today's browser world. In reality the %age in the target audience for one of my sites is closer to 25%.
Hug_It
08-16-2005, 11:41 PM
See, I was well aware of those statistics and after careful consideration I decided to go with the simple approach of straight HTML in order to ensure the broadest availablity. :rolleyes:
LOL
abcohen
08-17-2005, 02:37 AM
Originally posted by Hug_It@Aug 16 2005, 07:41 PM
See, I was well aware of those statistics and after careful consideration I decided to go with the simple approach of straight HTML in order to ensure the broadest availablity.* :rolleyes:
LOL
720
LOL is right :blink:
either one works...
Hug_It, would you create a new post in the tutorial section with how to edit it :D [you can even include the javascript code -- even if 10% cant use it]
Thanks to both of you!
I've choosen the java-method to open a new popup-window - but I want to have just the article in the new window, not the hole page showing the specific artikle....
abcohen
08-19-2005, 01:50 PM
Originally posted by god@Aug 19 2005, 06:30 AM
Thanks to both of you!
I've choosen the java-method to open a new popup-window - but I want to have just the article in the new window, not the hole page showing the specific artikle....
757
this could be done is you have the print option turned on...
abcohen
08-19-2005, 03:28 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.
Wow, this would be an amazing soloution!
BUT: It just gives me a "parse error" (Parse error: parse error in /html/plugins/p2_news/news.php on line 406)
Thanks a lot again!
abcohen
08-24-2005, 03:10 AM
sorry this was updated on
http://www.subdreamer.org/forum/index.php?showtopic=131
but not here... not it works GREAT :D
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.