views:

23

answers:

1

Hi, i just followed the answers provided in this question: http://stackoverflow.com/questions/1310649/getting-a-modified-preorder-tree-traversal-model-nested-set-into-a-ul

I already built my database and is working properly, printing all the child and parent pages with the correct identation.

But, i want to make it like a web search. So, if someone searches for the string "comunication" i want to be sure that all pages that has that string will be shown like this:

Index
Page 1 (2)
Page 2 (3)
Page 3 (1)
      Page 3.1 (7)
      Page 3.2 (6)
Page 4
      Page 4.1
         Page 4.1.1 (10)

The number betwen () are the ocurrencies.

How can i make this? Because, it is possible that a child page have a ocurrency and that the parent doesnt, so i have to make sure only the pages that have ocurrencies will be shown, but if this page is a child, its parents need to be printed.

Any ideas? Ty!

A: 

Anyone plz help?

JoJovem