Mam taki kod, wszystko jest dobrze dopóki nie ma bardziej skomplikowanej hierarchii stron.
  1. <?php
  2. $list = '<select name="page">';
  3.  
  4. for($i = 0; $i < count($this->PageList); $i++)
  5. {
  6. $checked = ($this->PageList[$i]['page_id'] == $id) ? 'selected' : '';
  7.  
  8. if($this->PageList[$i]['page_parent'] == 0)
  9. {
  10. $list .= '<option value="' . $this->PageList[$i]['page_id'] . '" ' . $checked . '>' . $this->PageList[$i]['page_title'] . '</option>';
  11.  
  12.  
  13. for($j = 0; $j < count($this->PageList); $j++)
  14. {
  15. if($this->PageList[$j]['page_parent'] == $this->PageList[$i]['page_id'])
  16. {
  17. $par = 1;
  18.  
  19. $list .= '<option value="' . $this->PageList[$j]['page_id'] . '" ' . $checked . '>- ' . $this->PageList[$j]['page_title'] . '</option>';
  20.  
  21. for($a = 0; $a < count($this->PageList); $a++)
  22. {
  23. if($this->PageList[$a]['page_parent'] == $this->PageList[$j]['page_id'])
  24. {
  25. $par = $par+1;
  26. }
  27. }
  28.  
  29. if($par > 1)
  30. {
  31. $tag = '-';
  32.  
  33. for($r = 0; $r < count($this->PageList); $r++)
  34. {
  35. if($this->PageList[$j]['page_id'] == $this->PageList[$r]['page_parent'])
  36. {
  37. $tag .= '-';
  38. $list .= '<option value="' . $this->PageList[$r]['page_id'] . '" ' . $checked . '>' . $tag . ' '. $this->PageList[$r]['page_title'] . '</option>';
  39. }
  40. }
  41. }
  42. }
  43. }
  44. }
  45. }
  46.  
  47. if(!$parent)
  48. {
  49. $list .= '<option value="0">Nigdzie nie nalezy</option>';
  50. }
  51. $list .= '</select>';
  52. ?>


Wszystko jest ok na takim poziomie:
Strona główna
- podstrona 1
-- podstrona 2

a jak już daje 3 i 4 podstronę to pokazuje tak samo:
Strona główna
- podstrona 1
-- podstrona 2

Proszę o pomoc bo walczę z tym od wczoraj i się zamotałem smile.gif