Jump to content

son

Members
  • Posts

    1,024
  • Joined

  • Last visited

Posts posted by son

  1. In a php file I tried to generate xml and hoped thatheader('Content-Type: text/xml');at top would just do this... It doesn't. I can see the xml correctly formed in source code, but on page only the standard subscribe to feed message shows without the items from database... Is it not possible to use php file for xml? Thanks,Son

  2. I have a top nav where you only see items from next level if you hover over li item of main list. The css is:

    #navItems {margin:25px 0;}#navItems ul {float:right; margin-left:15px;}#navItems ul li {float:left; position:relative;}#navItems ul li a {display:block;padding:3px;}#navItems li ul {display: none; margin:0;}#navItems li:hover ul {position: absolute;display:inline; left:0;}#navItems ul li ul li {width:340px;}

    Initially I did not have:#navItems ul li ul li {width:340px;}but I added the width as text broke down in several rows if main list item narrower than sub-item. Now, I find that sometimes 340px does not work well and I would like to have the sub-items' width adjust to the relevant text lenght (that could be less, equal or more than main item. How can I achieve this? Also, is there a way to have more sub-levels with same hovering over parent item to show sub-items? I added another sub-level (level 3), but could not make it work... Son

    • Like 1
  3. I use mod-rewrite as:RewriteRule ^([A-Za-z0-9_-]+)$ webs.php?id=$1 [NC] It rewrites all URLs ok. However, I need to insert a language option (Italian and English) and this does not work due to rewrite rule. Has anyone experience and let me know how to change my rewrite rule? Thanks,Son

  4. I did set

    $childrenTree = array();

    just before loop as suggested and had then also added a check if $parent is set in function as

    	 if(isset($parent) && $parent != 0)  {

    I still get the same 'Undefined index: ' for all the entries that are not parents themselves... The one that is a parent to two entries is fine... Son

  5. But this is where the my problem is to understand. I only want to initialise when there are children as

    if(!array_key_exists($catParent, $childrenTree))  $childrenTree[$catParent] = array();  $childrenTree[$catParent][] = (string)$catID;

    However, going through all the thrown error codes after 'Undefined variable: childrenTree' it also repeatetly complains 'Undefined index'. Checking all those indexes in detail I can clearly see that those are all the ones without children. The one category with children does not come up in error code. Also, that it works on other page exactly like it is totally confuses me... Any ideas where else I could check? Son

  6. In my desperation I have tried already above this bit of code: $childrenTree = 0; $childrenTree = ''; $childrenTree = FALSE;The first about undefined variable indeed gone, but still 'The second argument should be either an array or an object'. In addition, I did not do anything else on other pages where it is working... Could it be that other variable infringe with the code? I do not have another $childrenTree, but maybe another one is causing this? Son

  7. I use the following data and function successfully on another page that has lots of other stuff going on (and a test page with only this bit):

    while (list($catID, $catNameSelect, $catParentSelect) = mysqli_fetch_array($catResult, MYSQLI_BOTH))  {  $categoryNR[(string)$catID] = $catID;  $categoryNames[(string)$catID] = $catNameSelect;	  $catParent = (string)$catParentSelect;	   if(!array_key_exists($catParent, $childrenTree))  $childrenTree[$catParent] = array();  $childrenTree[$catParent][] = (string)$catID;  }function renderTree($parent = 0, $subCounter = 0){global $cid;global $categoryNR;    global $categoryNames;    global $childrenTree;	 if($parent != 0)  {  echo "<option value=\"webster.php?cid=" . $categoryNR[$parent] .  "\"";  echo " style=\"padding-left:" . $subCounter . "px;\">", $categoryNames[$parent], "</option>\n";  $subCounter = $subCounter + 10;  }    $children = $childrenTree[$parent];	 if(count($children) > 0)  { //If node has children	    foreach($children as $child)	    renderTree($child, $subCounter);	 }  }renderTree();  //This renders the hierarchical tree

    However, on the relevant page it shows drop down ok, but when you look in code you can see that there is an issue...Undefined variable: childrenTreearray_key_exists() [<a href=function.array-key-exists'>function.array-key-exists</a>]: The second argument should be either an array or an object I do not get this. It is working fine on other page/s with same query and the lot. Why is it saying that childrenTree is not defined in this case? Where could I look? Thanks,Son

×
×
  • Create New...