ID: 39535
User updated by: mark at divinedesigns dot ca
Reported By: mark at divinedesigns dot ca
Status: Open
Bug Type: Variables related
Operating System: linux
PHP Version: 5.2.0
New Comment:
these functions work perfectly well when used on their own... but not
so when combined...
Previous Comments:
------------------------------------------------------------------------
[2006-11-16 16:29:22] mark at divinedesigns dot ca
<?
function shownavs(){
global $allnavs, $blocknavs, $head, $autokey;
if(isset($allnavs)){
$navsoutput .= '<table>';
foreach($allnavs as $group => $i){
$title = $group;
foreach($i as $name => $link){
if(isset($link)){
$content .= '<br>'.$name; #this line usually has same issue,
altered for bug report
}
}
$text .=
'<tr><td>'.set_collapse($title,$content,$group).'</td></tr>';
unset($content);
}
$navsoutput .= $text.'</table>';
}
return $navsoutput;
}
function set_collapse($title,$text,$name){
global $collapsenum, $css, $head;
if(!isset($collapsenum)){
$collapsenum = "1";
$head .= '<script language="javascript">
var ie4 = false;
if(document.all){
ie4 = true;
}
function getObject(id){
if(ie4){
return document.all[id];
}else{
return document.getElementById(id);
}
}
function toggle(link, divId, Name){
var lText = link.innerHTML;
var d = getObject(divId);
if(lText == \'+\'){
link.innerHTML = \'-\';
d.style.display = \'block\';
document.cookie = Name + "=shown";
}else{
link.innerHTML = \'+\';
d.style.display = \'none\';
document.cookie = Name + "=hidden";
}
}
</script>'; # it should be returning this outside of both the
functions
}
return '<table cellspacing=0 width="50%" class=collapse>
<tr class=collapsetitle>
<td class=navtitle>[<a title="Show/Hide" class=toggle
href="javascript: void(0);"
onclick="toggle(this,\''.$key.'\',\''.$name.'\');">'.$h.'</a>]'.$title.'</td>
</tr>
<tr id="'.$key.'" class="'.$hidden.'">
<td>'.$text.'</td>
</tr>
</table>';
}
$allnavs[test]=test.php
$body = shownavs();
echo $head;
echo $body;
?>
------------------------------------------------------------------------
[2006-11-16 16:24:54] [EMAIL PROTECTED]
Please provide SHORT but COMPLETE reproduce code. Some comments in the
code with expected and actual results are appreciated.
------------------------------------------------------------------------
[2006-11-16 16:14:54] mark at divinedesigns dot ca
my source code is shown on these two webpages
http://taith.divinedesigns.ca/bug.php
http://taith.divinedesigns.ca/bug2.php
------------------------------------------------------------------------
[2006-11-16 16:10:49] [EMAIL PROTECTED]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2006-11-16 16:01:48] mark at divinedesigns dot ca
Description:
------------
basically...
function2 is in function1, function 2 has a globalized variable, but
it is not passing out of funcion 1 or 2, if i set it to echo the
variable, info comes out, but thats not very helpful...
Reproduce code:
---------------
i'll put it at taith.divinedesigns.ca/bug.php,
taith.divinedesigns.ca/bug2.php
Expected result:
----------------
the +/- buttons are supposed to click on(javascript) and hide/show the
contents underneath
Actual result:
--------------
no action, the $head variable doesnt pass from function #1 to function
#2
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39535&edit=1