Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
2 + 3 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
     
query($sql); while ($row = $xoopsDB->fetchArray($result)) { $objsArray[] = new XoopsDummyObject($row, $id_name, $pid_name, $title_name); } $mytree = new XoopsObjectTree($objsArray, $id_name, $pid_name); $i = 0; $sql = "SELECT `$id_name`, `$title_name` FROM ".$xoopsDB->prefix."_"."$table WHERE `$pid_name`= 0" ; if ($order != '') { $sql .= " ORDER BY `$order`" ; } $result = $xoopsDB->query($sql); while (list($catid, $name) = $xoopsDB->fetchRow($result)) { $xsitemap['parent'][$i]['id'] = $catid; $xsitemap['parent'][$i]['title'] = $myts->htmlSpecialChars( $name ) ; $xsitemap['parent'][$i]['url'] = $url.$catid; //if($xsitemap_configs["show_subcategories"]){ $j = 0; $child_array = $mytree->getAllChild($catid); foreach ($child_array as $child) { //$count = strlen($child['prefix']) + 1; $xsitemap['parent'][$i]['child'][$j]['id'] = $child[$id_name]; $xsitemap['parent'][$i]['child'][$j]['title'] = $myts->htmlSpecialChars( $child[$title_name] ) ; //$xsitemap['parent'][$i]['child'][$j]['image'] = (($count > 3) ? 4 : $count); $xsitemap['parent'][$i]['child'][$j]['url'] = $url.$child[$id_name]; $j++; } //} $i++; } return $xsitemap; } ?> [/code][/quote]" />

Re: problem with getAllChild
by trabis on 2009/8/20 17:21:39

Try this:
<?php /** * **************************************************************************** * Module généré par TDMCreate de la TDM "http://www.tdmxoops.net" * **************************************************************************** * xsitemap - MODULE FOR XOOPS AND IMPRESS CMS * Copyright (c) Urbanspaceman (http://www.takeaweb.it) * * You may not change or alter any portion of this comment or credits * of supporting developers from this source code or any supporting source code * which is considered copyrighted (c) material of the original comment or credit authors. * 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. * * @copyright Urbanspaceman (http://www.takeaweb.it) * @license GPL * @package xsitemap * @author Urbanspaceman (http://www.takeaweb.it) * * Version : 1.00: * **************************************************************************** */ //Show xsitemap function xsitemap_get_map($table, $id_name, $pid_name, $title_name, $url, $order = ""){ global $sitemap_configs; $xoopsDB =& Database::getInstance(); $xsitemap = array(); $myts =& MyTextSanitizer::getInstance(); $sql = "SELECT `$id_name`, `$pid_name`, `$title_name` FROM ".$xoopsDB->prefix."_"."$table" ; $result = $xoopsDB->query($sql); while ($row = $xoopsDB->fetchArray($result)) { $objsArray[] = new XoopsDummyObject($row, $id_name, $pid_name, $title_name); } $mytree = new XoopsObjectTree($objsArray, $id_name, $pid_name); $i = 0; $sql = "SELECT `$id_name`, `$title_name` FROM ".$xoopsDB->prefix."_"."$table WHERE `$pid_name`= 0" ; if ($order != '') { $sql .= " ORDER BY `$order`" ; } $result = $xoopsDB->query($sql); while (list($catid, $name) = $xoopsDB->fetchRow($result)) { $xsitemap['parent'][$i]['id'] = $catid; $xsitemap['parent'][$i]['title'] = $myts->htmlSpecialChars( $name ) ; $xsitemap['parent'][$i]['url'] = $url.$catid; //if($xsitemap_configs["show_subcategories"]){ $j = 0; $child_array = $mytree->getAllChild($catid); foreach ($child_array as $child) { //$count = strlen($child['prefix']) + 1; $xsitemap['parent'][$i]['child'][$j]['id'] = $child[$id_name]; $xsitemap['parent'][$i]['child'][$j]['title'] = $myts->htmlSpecialChars( $child[$title_name] ) ; //$xsitemap['parent'][$i]['child'][$j]['image'] = (($count > 3) ? 4 : $count); $xsitemap['parent'][$i]['child'][$j]['url'] = $url.$child[$id_name]; $j++; } //} $i++; } return $xsitemap; } ?>
Re: problem with getAllChild
by trabis on 2009/8/20 16:58:52

Damn, this is hard. Since we add extra value on the query you have to fix this:
le="color: #000000"><?php while (list($catid, $pid, $name) = $xoopsDB->fetchRow($result))
Re: problem with getAllChild
by urbanspacema on 2009/8/20 16:56:42

fixed but the problem is not that ...
I still do not see the child
Re: problem with getAllChild
by trabis on 2009/8/20 16:49:54

Of course, your query is not asking it.

le="color: #000000"><?php $sql = "SELECT `$id_name`, `$pid_name`, `$title_name` FROM ".$xoopsDB->prefix."_"."$table WHERE `$pid_name`= 0" ;


It needs to go on the row for the Object to work.
Re: problem with getAllChild
by urbanspacema on 2009/8/20 16:40:13

mmm don't work...

if i print print_r($objsArray);
it return this

le="color: #000000"><?php Array ( [0] => XoopsDummyObject Object ( [vars] => Array ( [topic_id] => Array ( [value] => 2 [required] => [data_type] => 3 [maxlength] => [changed] => [options] => ) [topic_pid] => Array ( [value] => [required] => [data_type] => 3 [maxlength] => [changed] => [options] => ) [topic_title] => Array ( [value] => Categoria news [required] => [data_type] => 1 [maxlength] => [changed] => [options] => ) ) [cleanVars] => Array ( ) [_isNew] => [_isDirty] => [_errors] => Array ( ) [_filters] => Array ( ) ) ) Array ( [0] => XoopsDummyObject Object ( [vars] => Array ( [topic_id] => Array ( [value] => 2 [required] => [data_type] => 3 [maxlength] => [changed] => [options] => ) [topic_pid] => Array ( [value] => [required] => [data_type] => 3 [maxlength] => [changed] => [options] => ) [topic_title] => Array ( [value] => Categoria news [required] => [data_type] => 1 [maxlength] => [changed] => [options] => ) ) [cleanVars] => Array ( ) [_isNew] => [_isDirty] => [_errors] => Array ( ) [_filters] => Array ( ) ) [1] => XoopsDummyObject Object ( [vars] => Array ( [topic_id] => Array ( [value] => 1 [required] => [data_type] => 3 [maxlength] => [changed] => [options] => ) [topic_pid] => Array ( [value] => [required] => [data_type] => 3 [maxlength] => [changed] => [options] => ) [topic_title] => Array ( [value] => XOOPS [required] => [data_type] => 1 [maxlength] => [changed] => [options] => ) ) [cleanVars] => Array ( ) [_isNew] => [_isDirty] => [_errors] => Array ( ) [_filters] => Array ( ) ) ) Array ( ) Array ( [0] => XoopsDummyObject Object ( [vars] => Array ( [topic_id] => Array ( [value] => 1 [required] => [data_type] => 3 [maxlength] => [changed] => [options] => ) [topic_pid] => Array ( [value] => [required] => [data_type] => 3 [maxlength] => [changed] => [options] => ) [topic_title] => Array ( [value] => Categoria ams [required] => [data_type] => 1 [maxlength] => [changed] => [options] => ) ) [cleanVars] => Array ( ) [_isNew] => [_isDirty] => [_errors] => Array ( ) [_filters] => Array ( ) ) ) Array ( )


Value for topic_pid is always empty...

Who's Online

745 user(s) are online (608 user(s) are browsing Support Forums)


Members: 0


Guests: 745


more...

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits