Click to See Complete Forum and Search --> : tree problem
zuzupus
08-01-2003, 06:51 AM
Hi,
is anybody there who can help in tree structure,actually what is happening whenever i click on soem child tree or parent node its jumping up i mean for seeing the link whom i clicked i have to scroll down everytime how to stop this i no there is client side javascript to hold this as everytime the tree loaded when i click on soem tree if anybody help me in this out i will be grateful.
if anybody needs code for this i can send as im helpless about this javascript maintainenance
thanks
gil davis
08-01-2003, 07:29 AM
Usually that means you have used an anchor with an onclick to do your navigating. Add ";return false" to the end of the existing onclick event, and the page won't jump anymore
zuzupus
08-01-2003, 07:39 AM
actually this is PHP and there is nothing like thatto add onclick as it is somethign like
<?
if ($active && $mayRead) {
list($info, $html_file) = once_query_array("SELECT info, html_file FROM t_directories WHERE sys_pk = $active");
if (is_true($info)) {
?>
parent.frames['content'].location.replace('../htm/<?=addslashes($html_file ? "infos/$html_file" : "empty.htm") ?>');
<? } else { ?>
parent.frames['content'].location.replace('filelist.phtml?type=<?=(($rights == 2) ? 1 : 0) ?>&tree=<?=$active ?>');
? } } else { ?>
parent.frames['content'].location.replace('blank.phtml');
<? } ?>
thanks if u want more code i can send u and the link also
gil davis
08-02-2003, 07:19 AM
Please post a link.
zuzupus
08-04-2003, 03:22 AM
this is the code i changed to get tree in stable position
still its not working the way u told me
ibut still getting tree problem the scroller always go up and i have to scroll down to see child or parent tree
-Tree (Parent)
-Tree1(child for Tree)
-Tree2(child for Tree and Tree1)
x
y(these 3 elements r child for Tree2)
z
but when i click something on y then i cant see the y in frame i have to scroll down to see the y,i mean to say its not stable like the example shown in http://javascript.internet.com/foldertree/
so i modify my PHP code something like this still no change
[PHP]
<?
function showTree($id, $level) {
global $tree, $session, $active;
$var = is_array($tree[$id]) ? $tree[$id] : array();
foreach($var as $pk => $name) {
if ($name[0] == chr(1)) { $new = true; $name = substr($name, 1); } else $new = false;
if ($name[0] == '+' || $name[0] == '-')
$link = 'href="'.htmlentities("pane1.phtml?flip=$pk&close=".($session->open[$pk] ? 1 : 0)).'#anchNode"';
else
$link = 'href="'.htmlentities("pane1.phtml?active=$pk").'#anchNode"';
?>
<p class="h<?=(($level > 4) ? 7 : ($level+3)) ?>"><?=str_repeat(' ', $level*3) ?><a name="anchNode"></a><a class="h<?=(($level > 4) ? 7 : ($level+3)) ?>" <?=$link ?>><?=(($active == $pk || $new) ? '<span class="'.($active == $pk ? 'white' : 'newfiles').'">' : '') ?><?=htmlentities($name) ?><?=(($active == $pk || $new) ? '</span>' : '') ?></a></p>
<?
if ($session->open[$pk])
showTree($pk, $level+1);
}
}
showTree(0, 0);
?>
[/PHP)
regarding link i dont have admin rights to show that one