Author
Message
Hi-Jack New Member Joined: Jan 09, 2004 Posts: 7
Posted:
Fri Jan 09, 2004 3:46 pm
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) */
/* */
/* */
/* 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) */
/* */
/************************************************************************/
/* Switch menu: */
/* made by Martial Boissonneault © 2001-2003 */
/************************************************************************/
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
This script may be used and changed freely as long as this msg is intact
Visit 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\"> ".$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\"> ".$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.
Raven Site Admin/Owner Joined: Aug 27, 2002 Posts: 15213 Location: Kansas
Posted:
Sat Jan 10, 2004 12:10 am
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\"> ".$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\"> ".$href."".$sub_title."</a><br/>\n";
}
}
closedir($handle_sub);
$content .="</span>\n";
}
}
closedir($handle_main);
echo $content;
CloseTable();
include("footer.php");
?>
Hi-Jack New Member Joined: Jan 09, 2004 Posts: 7
Posted:
Sat Jan 10, 2004 2:38 am
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 New Member Joined: Jan 09, 2004 Posts: 7
Posted:
Sat Jan 10, 2004 3:25 am
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?
(documents in Menu)
Thanks and sorry for the burden...
Hi-Jack New Member Joined: Jan 09, 2004 Posts: 7
Posted:
Sat Jan 10, 2004 7:48 am
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 Site Admin/Owner Joined: Aug 27, 2002 Posts: 15213 Location: Kansas
Posted:
Sat Jan 10, 2004 9:03 am
Thanks so much! Just got up and saw your messages. Glad you figured it out.
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