1
mko_san
MyTutorials v2.1b html problem - please help :(
  • 2005/4/3 16:38

  • mko_san

  • Just popping in

  • Posts: 6

  • Since: 2005/4/3 1


I have a problem with MyTutorials v2.1b module, the html code displayed on main tutorial page [with categories/sub categories etc] won't parse. Can anybody help me with that?

It parses fine on my tutorials category modify page though. My php coding skills are too poor to deal with this problem.

Any help would be greatly appreciated...

Here is the main index file:

<?php
//-------------------------------------------------------------------------- //
//  Tutorials Version 2.1 index.php                                           //
//                                                                             //
//    Author: Thomas (Todi) Wolf                                                 //
//    Mail:    todi@dark-side.de                                                 //
//    Homepage: http://www.mytutorials.info                                     //
//                                                                             //
//    for Xoops                                                                 //
// ------------------------------------------------------------------------- //
//  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, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
// ------------------------------------------------------------------------- //

include "header.php";
include_once(
XOOPS_ROOT_PATH."/class/xoopstree.php");
$mytree = new XoopsTree($xoopsDB->prefix("tutorials_categorys"),"cid","scid");
$myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object
define("IMAGE_PATH",XOOPS_ROOT_PATH."/modules/tutorials/images");
define("IMAGE_URL",XOOPS_URL."/modules/tutorials/images");
// -----------------------------------------------------------------------------------------------------------//
$colcount 0;
    if (
$xoopsConfig['startpage'] == "tutorials"){
        
$xoopsOption['show_rblock'] =1;
        include 
XOOPS_ROOT_PATH."/header.php";
        
make_cblock();
    } else {
        
$xoopsOption['show_rblock'] =0;
        include 
XOOPS_ROOT_PATH."/header.php";
    }
    
OpenTable();
    
$result $xoopsDB->query("select cid, cname, cdesc, cimg, cimgwidth, cimgheight from ".$xoopsDB->prefix("tutorials_categorys")." where scid=0 order by cname");
    
$catcount $xoopsDB->getRowsNum($result);
    echo 
"<center><img src="images/tutorials.gif" border="0" Alt="Tutorials"><br /><br />";
    if (
$heading == "") {
        
printf(_MD_WELCOMETOTUTS,$xoopsConfig['sitename']);
    } else {
        echo 
$heading;
    }
    echo 
"<br /><br />";
    echo 
"<table width=80% cellspacing=4 cellpadding=0 border=0 valign=top><tr>";
    while (
$myrow $xoopsDB->fetchArray($result)){
        
$cname $myts->makeTboxData4Show($myrow['cname']);
        
$cdesc $myts->makeTboxData4Show($myrow['cdesc']);
        
$cimg $myts->makeTboxData4Show($myrow['cimg']);
        
$number getTotalItems($myrow['cid'], 13);
        if (
$category_visdefault == 1) {
            
$show $category_visualize;
        } else {
            
$show $category_default;
        }
        
$arr=array();
        
$arr=$mytree->getFirstChild($myrow['cid'], "cname");
        
$space 0;
        
$chcount 0;
        
$subcats "";
        foreach(
$arr as $ele){
            
$chtitle=$myts->makeTboxData4Show($ele['cname']);
            if (
$chcount $maxsubcatshow){
                
$subcats .= "...";
                break;
            }
            if (
$space>0) {
                
$subcats .= ", ";
            }
               
$subcats .= "<a href="".XOOPS_URL."/modules/tutorials/listtutorials.php?cid=".$ele['cid']."">".$chtitle."</a>";
            
$space++;
            
$chcount++;
        }
        if (
$cimg != "") {
            if (
ereg("http://",$cimg)) {
                
$imgpath $cimg;
            } else {
                
$imgpath "".IMAGE_URL."/$cimg";
            }
            if (
$myrow['cimgwidth'] > && $myrow['cimgheight'] > 0){
                
$setsize ="width=".$myrow['cimgwidth']." height=".$myrow['cimgheight'];
            } else {
                 
$setsize ="";
             }
            
$show str_replace("[image]","<a href=listtutorials.php?cid=".$myrow['cid']."><img src="".$imgpath."" ".$setsize." border=1 alt="$cname"></a>",$show);
            
$show str_replace("[image right]","<a href=listtutorials.php?cid=".$myrow['cid']."><img src="".$imgpath."" ".$setsize." border=1 alt="$cname" align="right"></a>",$show);
            
$show str_replace("[image left]","<a href=listtutorials.php?cid=".$myrow['cid']."><img src="".$imgpath."" ".$setsize." border=1 alt="$cname" align="left"></a>",$show);
        } else {
            
$show str_replace("[image]","",$show);
        }
        
$show str_replace("[title]","<a href=listtutorials.php?cid=".$myrow['cid'].">".$cname."</a>",$show);
        
$show str_replace("[subcat]","$subcats",$show);
        
$show str_replace("[description]","$cdesc",$show);
        if(
$number == 1){
            
$count "&nbsp;<small>(".sprintf(_MD_TUTORIALCOUNTONE,$number).")</small>";
        }else{
            
$count "&nbsp;<small>(".sprintf(_MD_TUTORIALCOUNTMORE,$number).")</small>";
        }
        
$show str_replace("[count]","$count",$show);
        
$show str_replace("[link]","<a href=listtutorials.php?cid=".$myrow['cid'].">"._MD_LETSGO."</a>",$show);
        if (
$columnset == 1) {
            echo 
"<td>".$show."</td>";
            echo 
"</tr><tr>";
        } else {
            echo 
"<td width="50%" valign="top">".$show."</td>";
            if (++
$colcount == 2) {
                
$colcount 0;
                echo 
"</tr><tr>";
            }
        }
    }
    echo 
"</tr></table></center>";
    
CloseTable();
    include 
XOOPS_ROOT_PATH."/footer.php";

?>


Thank you for any help provided...

2
mko_san
Re: MyTutorials v2.1b html problem - please help :(
  • 2005/4/3 20:59

  • mko_san

  • Just popping in

  • Posts: 6

  • Since: 2005/4/3 1


come on guys... a little help here would be very nice...

what can I do with that echo command???

I looked at source of the already displayed page, and first 3 tags <html><body><strong> look like this:
& lt;html& gt;
& lt;body& gt;
& lt;strong& gt;
[without the spaces after &]

Any idea how I can make it parse the html tags, except spiting out those codes, unrecognized by html compiler? [well the do parse to < and >, but that's not what I want obviously... I want them to be recognized and parsed as tags, not text]

Help!

3
mko_san
Re: MyTutorials v2.1b html problem - please help :(
  • 2005/4/4 9:53

  • mko_san

  • Just popping in

  • Posts: 6

  • Since: 2005/4/3 1


I really need some help here..... I'm going crazy from all that php stuff... I've been searching for anything thatcould help sove this for last 24h, all the time T_T

I found out that the sinstallation instruction unclude following info:

Quote:
4. Activate in the preference of XOOPS "Allow HTML tags in user comments?"


That might be the source of the problem, why html is not parsing.

I belive that's an option from XOOPS 1, I'm runing XOOPS 2.0.9.2.

Does anyone know where to enbale this option? what code to edit? or how to modify myTutorials source code to work...

4
mko_san
Re: MyTutorials v2.1b html problem - please help :(
  • 2005/4/5 23:04

  • mko_san

  • Just popping in

  • Posts: 6

  • Since: 2005/4/3 1


- bump -

help me guys T_T please T_T

any ideas how to force html parsing at database output string? Maybe something like pre-pasing it to make sure it has tagsin tact [not sth like & lt;html& gt;] before it reaches html parser?

please, please, please help me with it T_T

5
Peekay
Re: MyTutorials v2.1b html problem - please help :(
  • 2005/4/6 0:12

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


I was going to suggest posting your question directly on the developer's site, but I took a look at it and I get the impression that they only speak german!

I can't help with the PHP at all I'm afraid, but if you don't manage to get it sorted out, having looked at the Tutorials demo, I would have thought the Articles , arMS, AMS or WF-Sections modules could provide the same functionality

You might also want to investigate ecoTut 1.2. I am sure I have seen another teaching module somewhere, but this is all that a search for tutorial on Xoops.org shows up.

6
mko_san
Re: MyTutorials v2.1b html problem - please help :(
  • 2005/4/6 0:47

  • mko_san

  • Just popping in

  • Posts: 6

  • Since: 2005/4/3 1


Quote:

Peekay wrote:
I was going to suggest posting your question directly on the developer's site, but I took a look at it and I get the impression that they only speak german!


lol. well if you look at dev's profile it says he logged in last time sometime last year. I sent him an email with a plea for help, got no anwser do far.

Quote:

I can't help with the PHP at all I'm afraid, but if you don't manage to get it sorted out, having looked at the Tutorials demo, I would have thought the Articles , arMS, AMS or WF-Sections modules could provide the same functionality

You might also want to investigate ecoTut 1.2. I am sure I have seen another teaching module somewhere, but this is all that a search for tutorial on Xoops.org shows up.


I tried AMS, it won't do at all. I'll try other ones, ecoTut sounds nice xD

Thx for help, Peekay ^_^
Too bad you can't help me with that PHP problem..

anybyde has any isead on how to force XOOPS to parse html parsing at database output string [using echo to display output]???

7
mko_san
Re: MyTutorials v2.1b html problem - please help :(
  • 2005/4/8 20:59

  • mko_san

  • Just popping in

  • Posts: 6

  • Since: 2005/4/3 1


Well I figured it out...

to fix html problem, open up /tutorials/index.php

find
$myts->makeTboxData4Show($myrow['cdesc']);


replace with
$cdesc $myrow['cdesc'];


if you need html in title, then find
$myts->makeTboxData4Show($myrow['cname']);


replace with
$cname $myrow['cname'];


Another bug in this module is [ratethis] tag not parsing in tutorial view. To fix it open /tutorials/viewtutorial.php and find
$content str_replace("[date]","$date",$content);


add after
$content str_replace("[ratethis]","&nbsp;<a href="rate.php?tid=$tid"><b>"._MD_RATETHIS."</b></a>",$content);


There is ton of bugs in this module, it took me last 6 days to fix so it works for me. The blocks are totally screwed up, you will end up re-making them.

Here is my tutorials_top.php file. It should work for you, if you change respective file paths.

<?php
/******************************************************************************
 * Function: b_tutorials_top_show
 * Input   : $options[0] = date for the most recent links
 *                    hits for the most popular tutorials
 *           $block['content'] = The optional above content
 *           $options[1]   = How many reviews are displayes
 * Output  : Returns the desired most recent or most popular tutorials
 ******************************************************************************/
function b_tutorials_top_show($options) {
    global 
$xoopsDB$framebrowse;
    include_once 
XOOPS_ROOT_PATH."/modules/anime/cache/config.php";
    include 
XOOPS_ROOT_PATH."/xoops.ccs";
    
$block = array();
    
$block['content'] = "<table width='100%' cellpadding="4" cellspacing=0><tr><td id="animenu" cellpadding="3"><small>";
    
$myts =& MyTextSanitizer::getInstance();
    
$result $xoopsDB->query("select tid, tname, tlink, codes, status, hits, date from ".$xoopsDB->prefix("tutorials")." WHERE status=1 or status=3 ORDER BY ".$options[0]." DESC",$options[1],0);
    while (list(
$tid$tname$tlink$codes$status$hits$date) = $xoopsDB->fetchRow($result) ) {
        
$tname $myts->makeTboxData4Show($tname);
        if ( !
XOOPS_USE_MULTIBYTES ){
            if (
strlen($tname) >= 21) {
                
$tname substr($tname,0,20)." ...";
            }
        }
        if (
$tlink != "") {
            if (
$framebrowse == || $codes >= 10) {
                
$link_url "".XOOPS_URL."/modules/anime/viewexttutorial.php?tid=$tid";
                
$link_target "";
            } else {
                
$link_url $tlink;
                
$link_target " target="_blank"";
            }
            
$block['content'] .= "<a class="menuAni" href="'.$link_url.'" ".$link_target."><strong><big>·</big></strong>".$tname."</a>";
        } else {
            
$block['content'] .= "<a href="".XOOPS_URL."/modules/anime/viewtutorial.php?tid=$tid"><strong><big>·</big></strong>&nbsp;$tname</a>";
        }
        
$count 7;    //7 days
        
$startdate = (time()-(86400 $count));
        if (
$startdate $time) {
            if(
$status==1){
                
$block['content'] .= "&nbsp;<img src="".XOOPS_URL."/modules/anime/images/newred.gif" />";
            } elseif (
$status==3){
                
$block['content'] .= "&nbsp;<img src="".XOOPS_URL."/modules/anime/images/update.gif" />";
               }
        }        
        if(
$options[0] == "date"){
            
$block['content'] .= "<div align="right" class="menuMain">&nbsp;<small>(".formatTimestamp($date,'s').")&nbsp;</small></div>";
            
$block['title'] = _MB_BLOCK_TITLE1;
        }elseif(
$options[0] == "hits"){
            
$block['content'] .= "<div align="right">&nbsp;<small>(".$hits.")&nbsp;</small></div>";
            
$block['title'] = _MB_BLOCK_TITLE2;
        }
    }
    
$block['content'] .= "</small></td></tr></table>";
    return 
$block;
}


function 
b_tutorials_top_edit($options) {

    
$form ""._MB_TUTORIALS_DISP."&nbsp;";
    
$form .= "<input type='hidden' name='options[]' value='";
    if(
$options[0] == "date"){
        
$form .= "date'";
    }else {
        
$form .= "hits'";
    }
    
$form .= " />";
    
$form .= "<input type='text' name='options[]' value='".$options[1]."' />&nbsp;"._MB_TUTORIALS_TUTS."";
    return 
$form;
}
?>


I suggest you modyfy you short timestammp to something good looking, like "05 Apr 08", that way it will look nicer while used with above blocks ^_^

Good luck with this module, if you are going to use it, there is lots more bugs in it.. I found it easier to fix it then to write my own xP

8
DogTags
Re: MyTutorials v2.1b html problem - please help :(
  • 2005/4/29 12:43

  • DogTags

  • Just popping in

  • Posts: 50

  • Since: 2004/12/4


I was thinking of trying this mod. Have you gotten things sorted out? Is it working okay now?

I would love to put some tutorials on the site, but I'm no code-meister. I'd be afraid I'd mess up the whole show.

Thanks

Login

Who's Online

207 user(s) are online (143 user(s) are browsing Support Forums)


Members: 0


Guests: 207


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