1
johny
Tinycontent module - how to include a printer-friendly page
  • 2003/11/14 14:28

  • johny

  • Just popping in

  • Posts: 23

  • Since: 2003/8/25


I only miss one thing - Printer Friendly option.

Could someone guide me how to implement that into the module?

I tried to do it myself but I need help. I believe two files have to be hardcoded. First, in the index.php, an additional line has to be added. If we take an example from TINYEVENT module, where this line enables the printer friendly function:
$content .= "<br /><div align='right'><a href='index.php?op=print&id=$id'><img src='".XOOPS_URL."/modules/news/images/print.gif' border='0' alt='"._TE_PRINTERPAGE."' /></a></div>";


The second change is creating a printer.php file, or adding a print function into the index.php file, just like in the TINYEVENT module.

TINYCONTENT, however, has a different structure, and I don't know how to do all that. Here's the index.php file of the module:
include "../../mainfile.php";

if ( 
file_exists("language/".$xoopsConfig['language']."/modinfo.php") ) {
    include(
"language/".$xoopsConfig['language']."/modinfo.php");
} else {
    include(
"language/english/modinfo.php");
}

$id = isset($HTTP_GET_VARS['id']) ? intval($HTTP_GET_VARS['id']) : 0;

if (
$id != 0) {
  
$result $xoopsDB->queryF("SELECT storyid, title, text, visible, nohtml, nosmiley, nobreaks, nocomments, link, address FROM ".$xoopsDB->prefix(_MI_TINYCONTENT_PREFIX)." WHERE storyid=$id");
}
else {
$result $xoopsDB->queryF("SELECT storyid FROM ".$xoopsDB->prefix(_MI_TINYCONTENT_PREFIX)." WHERE homepage=1");
list(
$storyid) = $xoopsDB->fetchRow($result);
header("Location: $PHP_SELF?id=$storyid");
}
include_once 
XOOPS_ROOT_PATH.'/header.php';
list(
$storyid,$title,$text,$visible,$nohtml,$nosmiley,$nobreaks,$nocomments,$link,$address) = $xoopsDB->fetchRow($result);
    
      if (
$link == 1) {
        
// include external content
        
        
$includeContent XOOPS_ROOT_PATH."/modules/"._MI_DIR_NAME."/content/".$address;
        if (
file_exists($includeContent)){
          
$xoopsOption['template_main'] = 'tc_index.html';
        
          
ob_start();
          include(
$includeContent);
          
$content ob_get_contents();
          
ob_end_clean();
          
//$content = include($includeContent);

          
$xoopsTpl->assign('title'$title);
          
$xoopsTpl->assign('content'$content);
          
$xoopsTpl->assign('nocomments'$nocomments);
        }
        else{
            
redirect_header("index.php",1,_TC_FILENOTFOUND);
        }
      }
      else {
        
// tiny content
        
$xoopsOption['template_main'] = 'tc_index.html';

        if (
$nohtml == 1) { $html 0; } else { $html 1; }
        if (
$nosmiley == 1) { $smiley 0; } else { $smiley 1; }
        if (
$nobreaks == 1) { $breaks 0; } else { $breaks 1; }

        
$myts =& MyTextSanitizer::getInstance();
        
$text=$myts->displayTarea($text$html$smiley11$breaks);
        
        
$xoopsTpl->assign('title'$title);
        
$xoopsTpl->assign('content'$text);
          
$xoopsTpl->assign('nocomments'$nocomments);
      }

include 
XOOPS_ROOT_PATH.'/include/comment_view.php';
include_once 
XOOPS_ROOT_PATH.'/footer.php';


I could certainly use some advice. Please offer your thoughts; I'm sure many of you know how to fix that with no sweat.

2
chapi
Re: Tinycontent module - how to include a printer-friendly page
  • 2003/11/14 15:15

  • chapi

  • Theme Designer

  • Posts: 611

  • Since: 2002/1/22


I will create a page where you can show your content printer friendly over the weekend. Please be patient for this time

Btw, please avoid double posting .. thx

3
johny
Re: Tinycontent module - how to include a printer-friendly page
  • 2003/11/15 10:12

  • johny

  • Just popping in

  • Posts: 23

  • Since: 2003/8/25


OK. Thanks for the effort. I didn't actually expect a complete service :) but the help is definitely much appreciated and I'm grateful for your effort.

I'm sorry about the double posting; I wasn't exactely sure where to post...

Trying to exercise my patience

Login

Who's Online

225 user(s) are online (144 user(s) are browsing Support Forums)


Members: 0


Guests: 225


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits