Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> News Module Hack - Enhancement Requests
Author Message
Hi-Jack
New Member
New Member



Joined: Jan 09, 2004
Posts: 7

PostPosted: Fri Jan 09, 2004 3:46 pm Reply with quote

But i tried modifying it and did no succeed.
Then again, i have no knowledge of PhP.

Is there any way one can load a "block" as "module".
I mean, convert a block to a module.

Here is the code from a block autohtml i wish to use as a module autohtml:

*************************************************************<?php
/************************************************************************/
/* PHP-NUKE: Web Portal System */
/* =========================== */
/* */
/* Copyright (c) 2001 by Francisco Burzi (fbc@mandrakesoft.com) */
/* 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. */
/************************************************************************/
/* AUTOHTML (+PDF) v. 2.0 for PHP-NUKE */
/* Copyright (c) 2003 by Roberto Beltrame (webmaster@php-proxima.com) */
/* http://www.php-proxima.com */
/************************************************************************/
/* Switch menu: */
/* made by Martial Boissonneault © 2001-2003 http://getElementById.com/ */
/************************************************************************/
if (eregi("block-autohtml.php",$_SERVER[PHP_SELF])) {
Header("Location: ../index.php");
die();
}
/**** search user theme **********************/
global $ThemeSel;
get_theme();
/**** style for switch menu ******************/
$content .= "<style type=\"text/css\">
.menuOut { cursor:pointer; margin:7px; border:1px solid #000000; padding:2px; text-align:left; }
.menuOver { cursor:pointer; margin:7px; border:1px solid #000000; padding:2px; text-align:left; }
.submenu { padding-left:15px;}
.submenu a { text-decoration:none; font-weight:bold;}
.submenu a:hover { text-decoration:none; font-style:oblique; font-weight:bold;}
</style>";
/*********************************************/
$content .="
<script type=\"text/javascript\">
/*
Script made by Martial Boissonneault © 2001-2003 http://getElementById.com/
This script may be used and changed freely as long as this msg is intact
Visit http://getElementById.com/ for more free scripts and tutorials.
*/
function SwitchMenu(obj){
if(document.getElementById){
var el = document.getElementById(obj);
var ar = document.getElementById(\"cont\").getElementsByTagName(\"DIV\");
if(el.style.display == \"none\"){
for (var i=0; i<ar.length; i++){
ar[i].style.display = \"none\";
}
el.style.display = \"block\";
}else{
el.style.display = \"none\";
}
}
}
function ChangeClass(menu, newClass) {
if (document.getElementById) {
document.getElementById(menu).className = newClass;
}
}
</script>";
/*document.onselectstart = new Function(\"return false\");*/


$patterns[0] = "/.htm/";
$patterns[1] = "/.html/";
$patterns[2] = "/.pdf/";
$patterns[3] = "/_/";
$replacements[0] = "";
$replacements[1] = "";
$replacements[2] = "";
$replacements[3] = " ";

$handle_main=opendir('autohtml');
while ($file_title = readdir($handle_main)) {
if ((!ereg("[.]",$file_title))) {
$title_title=ereg_replace("_", " ", $file_title);
$menucount++; $menuid="menu".$menucount; $submenu="sub".$menucount;
$img="folder.gif";
$content .= "<div id=\"cont\">\n";
$content .= "<p id=\"".$menuid."\" class=\"menuOut\" onclick=\"SwitchMenu('".$submenu."')\" onmouseover=\"ChangeClass('".$menuid."','menuOver')\" onmouseout=\"ChangeClass('".$menuid."','menuOut')\"><img src=\"autohtml/".$img."\" alt=\"\" border=\"0\">&nbsp;&nbsp;".$title_title."</p>\n";
$content .="</div>\n";
$content .="<span class=\"submenu\" id=\"".$submenu."\" style=\"display:none;\">\n";
$handle_sub=opendir('autohtml/'.$file_title);
while ($file_sub = readdir($handle_sub)) {
if (ereg("(.)+\\.(htm$|html$|pdf$)",$file_sub)) {
if (ereg("(.)+\\.(pdf$)",$file_sub)) {
$href="<a href=\"autohtml/".$file_title."/".$file_sub."\">";
$img="pdf.gif";
} else {
$href="<a href=\"autohtml.php?filename=".$file_title."/".$file_sub."\">";
$img="html.gif";
}
$sub_title=preg_replace($patterns, $replacements, $file_sub);
$content .="<img src=\"autohtml/".$img."\" alt=\"\" border=\"0\">&nbsp; ".$href."".$sub_title."</a><br/>\n";
}
}
closedir($handle_sub);
$content .="</span>\n";
}
}
closedir($handle_main);


?>
*************************************************************

I'm prepaired to pay a little fee for whoever makes it work.
This comes from Autohtml version 2.

I'd like to use it but we have so many docs that a block, is just not good enough to show all the topics we write about.

(it does not look hard, i'm just to dumb to do it)

Thanks alot in advance.
 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sat Jan 10, 2004 12:10 am Reply with quote

Create a folder called 'autohtml' and place it in modules folder. Then, copy and paste this code in index.php in the modules/autohtml folder.
Code:
<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System */
/* =========================== */
/* */
/* Copyright (c) 2001 by Francisco Burzi (fbc@mandrakesoft.com) */
/* 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. */
/************************************************************************/
/* AUTOHTML (+PDF) v. 2.0 for PHP-NUKE */
/* Copyright (c) 2003 by Roberto Beltrame (webmaster@php-proxima.com) */
/* http://www.php-proxima.com */
/************************************************************************/
/* Switch menu: */
/* made by Martial Boissonneault © 2001-2003 http://getElementById.com/ */
/************************************************************************/
if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
    die ("You can't access this file directly...");
}

$module_name = basename(dirname(__FILE__));

$index = 1;

include("header.php");
OpenTable();

/**** search user theme **********************/
global $ThemeSel;
get_theme();
/**** style for switch menu ******************/
$content .= "<style type=\"text/css\">
.menuOut { cursor:pointer; margin:7px; border:1px solid #000000; padding:2px; text-align:left; }
.menuOver { cursor:pointer; margin:7px; border:1px solid #000000; padding:2px; text-align:left; }
.submenu { padding-left:15px;}
.submenu a { text-decoration:none; font-weight:bold;}
.submenu a:hover { text-decoration:none; font-style:oblique; font-weight:bold;}
</style>";
/*********************************************/
$content .="
<script type=\"text/javascript\">
/*
Script made by Martial Boissonneault © 2001-2003 http://getElementById.com/
This script may be used and changed freely as long as this msg is intact
Visit http://getElementById.com/ for more free scripts and tutorials.
*/
function SwitchMenu(obj){
if(document.getElementById){
var el = document.getElementById(obj);
var ar = document.getElementById(\"cont\").getElementsByTagName(\"DIV\");
if(el.style.display == \"none\"){
for (var i=0; i<ar.length; i++){
ar[i].style.display = \"none\";
}
el.style.display = \"block\";
}else{
el.style.display = \"none\";
}
}
}
function ChangeClass(menu, newClass) {
if (document.getElementById) {
document.getElementById(menu).className = newClass;
}
}
</script>";
/*document.onselectstart = new Function(\"return false\");*/


$patterns[0] = "/.htm/";
$patterns[1] = "/.html/";
$patterns[2] = "/.pdf/";
$patterns[3] = "/_/";
$replacements[0] = "";
$replacements[1] = "";
$replacements[2] = "";
$replacements[3] = " ";

$handle_main=opendir('autohtml');
while ($file_title = readdir($handle_main)) {
   if ((!ereg("[.]",$file_title))) {
      $title_title=ereg_replace("_", " ", $file_title);
      $menucount++; $menuid="menu".$menucount; $submenu="sub".$menucount;
      $img="folder.gif";
      $content .= "<div id=\"cont\">\n";
      $content .= "<p id=\"".$menuid."\" class=\"menuOut\" onclick=\"SwitchMenu('".$submenu."')\" onmouseover=\"ChangeClass('".$menuid."','menuOver')\" onmouseout=\"ChangeClass('".$menuid."','menuOut')\"><img src=\"autohtml/".$img."\" alt=\"\" border=\"0\">&nbsp;&nbsp;".$title_title."</p>\n";
      $content .="</div>\n";
      $content .="<span class=\"submenu\" id=\"".$submenu."\" style=\"display:none;\">\n";
      $handle_sub=opendir('autohtml/'.$file_title);
      while ($file_sub = readdir($handle_sub)) {
         if (ereg("(.)+\\.(htm$|html$|pdf$)",$file_sub)) {
            if (ereg("(.)+\\.(pdf$)",$file_sub)) {
               $href="<a href=\"autohtml/".$file_title."/".$file_sub."\">";
               $img="pdf.gif";
            } else {
               $href="<a href=\"autohtml.php?filename=".$file_title."/".$file_sub."\">";
               $img="html.gif";
            }
            $sub_title=preg_replace($patterns, $replacements, $file_sub);
            $content .="<img src=\"autohtml/".$img."\" alt=\"\" border=\"0\">&nbsp; ".$href."".$sub_title."</a><br/>\n";
         }
      }
      closedir($handle_sub);
      $content .="</span>\n";
   }
}
closedir($handle_main);


echo $content;
CloseTable();
include("footer.php");
?>
 
View user's profile Send private message
Hi-Jack







PostPosted: Sat Jan 10, 2004 2:38 am Reply with quote

Hi Raven,

This is great.
Thank you very much.

I just made a little donation to thank you.

(we do support people helping others, that's what we are all about
at MpegPlayer and this little mod, will help us a long way!)

Regards.
 
Hi-Jack







PostPosted: Sat Jan 10, 2004 3:25 am Reply with quote

Oops...
Does not seem to work fine...
A little error...

When i use the links, the menu shows up as it should but it also shows in the Survey block?

Could you stille have a look?
http://mpegplayer.hi-jack.net
(documents in Menu)

Thanks and sorry for the burden...
 
Hi-Jack







PostPosted: Sat Jan 10, 2004 7:48 am Reply with quote

Hey Raven,

After a few hours (how stupid can i be) i found the problem.
Seems like the autohtml index file was using $content as variable and the survey declares the same $content as global.
I changed the $content into $DocContent and everything works fine now.

Thanks again.
 
Raven







PostPosted: Sat Jan 10, 2004 9:03 am Reply with quote

Thanks so much! Just got up and saw your messages. Glad you figured it out.
 
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> News Module Hack - Enhancement Requests

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 ©