Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules
Author Message
candy
Worker
Worker



Joined: Dec 21, 2004
Posts: 225
Location: Kansas City metro

PostPosted: Mon Aug 01, 2005 12:32 pm Reply with quote

Hi all...just wondering what i can do to my content module so that it will have an option to print and/or email the article when someone clicks on it to read. I see this option is available for the news, but it doesn't appear on any of my content pages. thanks so much! Smile
 
View user's profile Send private message
hitwalker
Sells PC To Pay For Divorce



Joined:
Posts: 5661

PostPosted: Mon Aug 01, 2005 6:10 pm Reply with quote

Well it was a bit of a search specially when you run into a few topics that are not answered.(as usual)
This one is by our goodie chatserv...long ...long...ago...Smile
Do read all...very very good....



Code:


modules/Content/index.php:

Under the showpage function find:
Code:
   echo "<font class=\"title\">$mypage[title]</font><br>"

replace with:
Code:
   echo "<font class=\"title\">$mypage[title]</font><br><br><img src=\"images/print.gif\" border=\"0\" alt=\""._PRINTER."\" title=\""._PRINTER."\" width=\"16\" height=\"11\">&nbsp;&nbsp;<a href=\"modules.php?name=$module_name&pa=printpage&pid=$pid\">"._PRINTER."</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src=\"images/friend.gif\" border=\"0\" alt=\""._FRIEND."\" title=\""._FRIEND."\" width=\"16\" height=\"11\">&nbsp;&nbsp;
<a href=\"modules.php?name=$module_name&amp;file=friend&amp;op=FriendSend&amp;pid=$pid\">"
._FRIEND."</a><br><br>"

Find:
Code:
switch($pa) {

before add:
Code:
function PrintSecPage($pid) {
    global $site_logo, $nukeurl, $sitename, $datetime, $prefix, $db, $module_name;
    $sql = "SELECT * FROM ".$prefix."_pages WHERE pid='$pid'";
    $result = $db->sql_query($sql);
    $mypage = $db->sql_fetchrow($result);
    $mypage[text] = ereg_replace("<!--pagebreak-->", "<br>", $mypage[text]);
    echo "
    <html>
    <head><title>$sitename</title></head>
    <body bgcolor=\"#FFFFFF\" text=\"#000000\">
    <table border=\"0\"><tr><td>
    <table border=\"0\" width=\"640\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#000000\"><tr><td>
    <table border=\"0\" width=\"640\" cellpadding=\"20\" cellspacing=\"1\" bgcolor=\"#FFFFFF\"><tr><td>
    <center>
    <img src=\"images/$site_logo\" border=\"0\" alt=\"\"><br><br>
    <font class=\"content\">
    <b>$mypage[title]</b></font><br>
    $mypage[subtitle]<br>
    </center><font class=\"content\">
    ".nl2br($mypage[page_header])."<br><br>
    $mypage[text]
    ".nl2br($mypage[page_footer])."<br><br>";
    echo "</td></tr></table></td></tr></table>
    <br><br><center>
    <font class=\"content\">
    "._COMESFROM." $sitename<br>
    <a href=\"$nukeurl\">$nukeurl</a><br><br>
    "._THEURL."<br>
    <a href=\"$nukeurl/modules.php?name=$module_name&pa=showpage&pid=$pid\">
$nukeurl/modules.php?name=$module_name&pa=showpage&pid=$pid</a></font></center>
    </td></tr></table>
    </body>
    </html>
    ";
}

Find:
Code:
    case "list_pages_categories":
    list_pages_categories($cid);
    break;

before add:
Code:
    case "printpage":
    PrintSecPage($pid);
    break;


modules/Content/language/lang-your_language.php
find:
Code:
?>

before add:
Code:
define("_PRINTER","Printer Friendly Page");
define("_COMESFROM","This page comes from");
define("_THEURL","The URL for this page is:");
define("_FRIEND","Send to a Friend");
define("_YOUSENDSTORY","You will send the Content page");
define("_TOAFRIEND","to a specified friend:");
define("_FYOURNAME","Your Name:");
define("_FYOUREMAIL","Your E-mail:");
define("_FFRIENDNAME","Your Friend's Name:");
define("_FFRIENDEMAIL","Your Friend's E-mail:");
define("_INTERESTING","Interesting page at");
define("_HELLO","Hello");
define("_YOURFRIEND","Your Friend");
define("_CONSIDERED","considered the following Content page interesting and wanted to send it to you.");
define("_FDATE","Date:");
define("_FTOPIC","Topic:");
define("_YOUCANREAD","You can read interesting Content pages at");
define("_FSTORY","Page");
define("_HASSENT","Has been sent to");
define("_THANKS","Thanks!");
define("_SEND","Send");
define("_URL","URL");
define("_RECOMMEND","Recommend this Content page to a Friend");


New file, save the following as friend.php and place inside of the Content module:
Code:
<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/*         Additional security & Abstraction layer conversion           */
/*                           2003 chatserv                              */
/*      http://www.nukefixes.com -- http://www.nukeresources.com        */
/************************************************************************/

if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
   die ("You can't access this file directly...");
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
$pagetitle = "- "._RECOMMEND."";

function FriendSend($pid) {
    global $user, $cookie, $prefix, $db, $user_prefix, $module_name;
    $sid = intval($sid);
    if(!isset($sid)) { exit(); }
    include ("header.php");
    $row = $db->sql_fetchrow($db->sql_query("SELECT title FROM ".$prefix."_pages WHERE pid='$pid'"));
    $title = $row['title'];
    title(""._FRIEND."");
    OpenTable();
    echo "<center><font class=\"content\"><b>"._FRIEND."</b></font></center><br><br>"
   .""._YOUSENDSTORY." <b>$title</b> "._TOAFRIEND."<br><br>"
   ."<form action=\"modules.php?name=$module_name&amp;file=friend\" method=\"post\">"
   ."<input type=\"hidden\" name=\"pid\" value=\"$pid\">";
    if (is_user($user)) {
   $row2 = $db->sql_fetchrow($db->sql_query("SELECT username, user_email FROM ".$user_prefix."_users WHERE username='$cookie[1]'"));
   $yn = $row2['name'];
   $ye = $row2['user_email'];
    }
    echo "<b>"._FYOURNAME." </b> <input type=\"text\" name=\"yname\" value=\"$yn\"><br><br>\n"
   ."<b>"._FYOUREMAIL." </b> <input type=\"text\" name=\"ymail\" value=\"$ye\"><br><br><br>\n"
   ."<b>"._FFRIENDNAME." </b> <input type=\"text\" name=\"fname\"><br><br>\n"
   ."<b>"._FFRIENDEMAIL." </b> <input type=\"text\" name=\"fmail\"><br><br>\n"
   ."<input type=\"hidden\" name=\"op\" value=\"SendPage\">\n"
   ."<input type=\"submit\" value="._SEND.">\n"
   ."</form>\n";
    CloseTable();
    include ('footer.php');
}

function SendPage($pid, $yname, $ymail, $fname, $fmail) {
    global $sitename, $nukeurl, $prefix, $db, $module_name;
    $send_html_messages = "yes";
    $fname = removecrlf($fname);
    $fmail = removecrlf($fmail);
    $yname = removecrlf($yname);
    $ymail = removecrlf($ymail);   
    $pid = intval($pid);
    $mypage = $db->sql_fetchrow($db->sql_query("SELECT * FROM ".$prefix."_pages WHERE pid='$pid'"));
    $mytitle = $mypage['title'];
    $mytext = $mypage['text'];
    $mytext = ereg_replace("<!--pagebreak-->", "<br>", $mytext);
    $subject = ""._INTERESTING." $sitename";
    $message = ""._HELLO." $fname:<br>"._YOURFRIEND." $yname "._CONSIDERED."<br><br>$mytitle<br><b> </b><br>$mytext<br>"._URL.": <a href=$nukeurl/modules.php?name=$module_name&pa=showpage&pid=1>
$nukeurl/modules.php?name=$module_name&pa=showpage&pid=1</a><br>"._YOUCANREAD." $sitename<br><a href=$nukeurl>$nukeurl</a>";
        $xheaders = "From: " . $yname . " <" . $ymail . ">\n";
        $xheaders .= "X-Sender: <" . $ymail . ">\n";
        $xheaders .= "X-Mailer: PHP\n"; // mailer
        $xheaders .= "X-Priority: 6\n"; // Urgent message!
        if ($send_html_messages == "yes") {
                $xheaders .= "Content-Type: text/html; charset=iso-8859-1\n"; // Mime type
    }
    mail($fmail, $subject, $message, $xheaders);
    $title = urlencode($title);
    $fname = urlencode($fname);
    Header("Location: modules.php?name=$module_name&file=friend&op=PageSent&title=$mytitle&fname=$fname");
}

function PageSent($title, $fname) {
    include ("header.php");
    $title = urldecode($title);
    $fname = urldecode($fname);
    OpenTable();
    echo "<center><font class=\"content\">"._FSTORY." <b>$title</b> "._HASSENT." $fname... "._THANKS."</font></center>";
    CloseTable();
    include ("footer.php");
}

switch($op) {

    case "SendPage":
    SendPage($pid, $yname, $ymail, $fname, $fmail);
    break;
   
    case "PageSent":
    PageSent($title, $fname);
    break;

    case "FriendSend":
    FriendSend($pid);
    break;

}

?>


 
View user's profile Send private message
candy







PostPosted: Mon Aug 01, 2005 9:03 pm Reply with quote

WOW!! Laughing Laughing Thanks so much for finding and posting that! I admit, it looked a little intimidating when i first saw all the code, etc. but i read thru the whole thing and did it step by step! It worked! Smile

Thanks again!
 
candy







PostPosted: Wed Aug 03, 2005 6:53 pm Reply with quote

okay, update. my content mod now displays the print and email options at the top of every content page.....BUT i noticed that on my articles under my "Topics" that the "printer friendly page" and "send to a friend" options appear in a block on the right of the page. Just wondering how i can change the LAYOUT so that these options appear within or above/below the article itself rather than in the right blocks.....any ideas? Thanks! Smile
 
hitwalker







PostPosted: Wed Aug 03, 2005 7:02 pm Reply with quote

Ah but thats a designers choics candy.
When chatserv put this together he had to create a place i guess to put it all...
But you can send chatserve a PM and ask him to respond to your design question.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©