How to make recursive function for sitetree

I have a table in the db which contains the page names. Each page has an ID, subpages have a parentID that is the same as the PageID and there is a sort order.
What I would like to create is a site tree layout where I can add functionalities to add pages, modify order. In fact what I have in mind is something like this:
SITE EXPLORER
categories
article
edit category
items
order
www<sitename>.
[order]
Maincat 1
[+] [-][move]
[+][list]
[edit]
[+] [change]
Maincat  2
[+] [-][move]
[+][list]
[edit]
[+] [change]
[order]
      subcat 1
[+] [-][move]
[+][list]
[edit]
[+] [change]
      subcat 2
[+] [-][move]
[+][list]
[edit]
[+] [change]
Maincat 3
[+] [-][move]
[+][list]
[edit]
[+] [change]
[order]
      subcat 3
[+] [-][move]
[+][list]
[edit]
[+] [change]
           subcat 3.1
[+] [-][move]
[+][list]
[edit]
[+] [change]
      subcat 4
[+] [-][move]
[+][list]
[edit]
[+] [change]
      subcat 5
[+] [-][move]
[+][list]
[edit]
[+] [change]
Maincat 4
[+] [-][move]
[+][list]
[edit]
[+] [change]
So the column Site explorer has to be created dynamically. I don't know in advanced how deep the structure goes.
Any good ideas??
Bianca

Recursion then is exactly what you need.
I assume that your top level does not have any value in parentID, so that is where to start. I would do somethign like this.
<cfquery nam="parents">
WHERE parentid = ''
</cfquery>
<cfloop query="parents">
     <cfset buldLink(parent.text, parent.id) />
</cfloop>
<cffunction name="buildLink">
     <cfargument name="text" />
     <cfargument name="id" />
     <!--- Do whatever logic you need here to build the link --->
     <!--- You can output it here or return the value after the next part --->
     <!--- check for children --->
     <cfiquery name="children">
          WHERE parentid = #arguments.id# // Use cfqueryparam
     </cfquery>
     <cfif children.recordcount>
          <cfloop query="children">
               <cfset buildLink(children.text, children.id) />
          </cfloop>
     </cfif>
</cffunction>
Message was edited by: 12Robots Oops accidentally posted before I was done.

Similar Messages

  • How to make a form for input in web interface builder

    Hi expert:
        How to make a form for input in web interface builder?I have already used it to do PS planning, but I don't know how to  draw lines and checkboxes . Thanks in advance.
    Allen

    WAD:
    Open the WAD and create a new template. On the left hand navigation you will have several Web Items available. Under 'Standard' you have 'Analysis' item. Pull that into your template to the right. Under the Properties tab you need to pick the query [form/layout] that you have built in Query Designer.
    You will also find other items such as Button group, Checkbox, drop down, list box etc available. Pick and drag into the template whatever it is you require. Lets say you want a button. Under the Properties tab select the 'Command' that you require. You could use standard commands that are available there. You could also define functions and commands that you require.
    Query Designer:
    Open the QD and drag the characteristics and key figures that you require into the rows and columns of the QD. You would need to specify restrictions under the Filter tab of the QD based on the granularity of data that you require. You would need to remember that the key figures need to be made Input Ready [do this by clicking on KF and on the planning tab select "change by user and planning functions"].
    This shouldgive you a start. After you've explored it yourself a bit we can discuss further and I can certainly provide you additional details/material on these areas.
    Srikant

  • How to make each playlist for each movie songs ? when i tried to add songs all movie songs comes in row , its very difficult to find which movie song belongs?

    how to make each playlist for each movie songs ? when i tried to add songs all movie songs comes in row , its very difficult to find which movie song belongs?

    Thank you! I put some self help hypnosis tracks to listen to on my iPod. I did not want to go to the next track automatically, I wanted to listen to them individually, one at a time. (If I fell asleep, I did not want to 'wake up' in the middle of a different track.) Your information helps me understand that I need to re-load this playlist onto my iPod from my  Mac computer, only first, I need to UNCHECK the boxes in front of each track so the iPod will STOP each time after playing the selected track. It is too bad that so many functions are not availabvle within the iPod, but that is probably why they can make it so compact.

  • How to make a function return number(10,0) data type (ORACLE 10g)?

    With 10g, how to make a function return number(10,0) data type?
    here is the function, it returns a number type :
    create or replace FUNCTION Get_portfolio_Id3 (p_HistObjTable In Varchar2,p_LHISTOBJID IN NUMBER) RETURN view_cpu_STD_Asset.LPORTFOLIOITEMID%Type IS
    v_Id view_cpu_STD_Asset.LPORTFOLIOITEMID%Type;
    BEGIN
    If p_HistObjTable ='amPortfolio'
    then v_Id:=p_LHISTOBJID ;
    elsIf p_HistObjTable = 'amComputer' then
    select litemid into v_Id from smcdba.amComputer c where c.LCOMPUTERID=p_LHISTOBJID ;
    else v_Id:=-99;
    End If;
    RETURN v_Id;
    END Get_portfolio_Id3;
    Thanks.
    Message was edited by:
    user631701

    create or replace FUNCTION Get_portfolio_Id3 (p_HistObjTable In Varchar2,p_LHISTOBJID IN NUMBER) RETURN view_cpu_STD_Asset.LPORTFOLIOITEMID%Type IS
    v_Id view_cpu_STD_Asset.LPORTFOLIOITEMID%Type;
    BEGIN
    If p_HistObjTable ='amPortfolio'
    then v_Id:=p_LHISTOBJID ;
    elsIf p_HistObjTable = 'amComputer' then
    select litemid into v_Id from smcdba.amComputer c where c.LCOMPUTERID=p_LHISTOBJID ;
    else v_Id:=-99;
    End If;
    RETURN round(v_Id);
    END Get_portfolio_Id3;

  • How to make a group for selectd Object javascript

    How to make a group for selectd Object javascript

    There is currently no native way to email groups from iPad.
    The only way to do this is if your recipients are already members a a distribution group controlled elsewhere such as a Google Group or an  Exchange Organisation, then you can email the distribution group address which will then in turn forward to the individual email address of the members.
    Does it have to be email as currently you would have to add each recipient to the email manually.
    iOS to my knowledge doesn't support contact groups in context other than organisation.

  • How to make S-Curve for Primavear P6 by using BI publisher?

    Hi,
    Anyone knows how to make S-Curve for Primavear P6 by using BI publisher? I can display colunm such as planned unit, but not cumulative value. So I can't plot S-curve.
    Thanks
    Wang Xin
    Edited by: 957906 on 09-Sep-2012 03:26

    The problem with the datagridview is that it can only show one table.
    For more tables 3th party datagrid's are better. 
    Although you can start with using the old datagrid. Despite what is written on MSDN is it a complete different control then the datagridview. You can add in to your toolbox by right clicking on it and then add it.
    The datasource of a DataGrid can be a complete dataset which is showed with all its relations.
    Success
    Cor

  • SAP IDM 7.2: How to setup SSO functionality for WebUI of CRM and GRC?

    Hello IDM-experts,
    where can my customer find information about
    SAP IDM 7.2: How to setup SSO functionality for WebUI of CRM and GRC?
    Customer situation description:
    The situation is that we are using SAP IDM 7.2. We are using a functionality to allow our users to access a webpage from where they can gain
    SSO access to the Abap systems via the SAPGui. See screenshot as an example.
    Now what we want is to access the CRM and GRC WebUI also with the same SSO possibility. We cannot find any guide/best practice on how to do
    this or if it is possible via SAP IDM 7.2.
    You can see a weblink in the first screenshot but it does not work. It will ask you for a username and password, see second screenshot.
    Kind regards,
    Daniela

    Do you know how the SAP GUI SSO is setup ? Is it using SNC/Kerberos ?
    If it is (I suspect it is), then you will need to use similar method of authentication for the ICF Services. These cannot use SNC since they are accessed via browser, but what you want is possible.
    Thanks
    Tim

  • How to make a CheckBox for a report parameter?

    Hi,
    How to make a CheckBox for a report parameter?
    thanx

    design ur parameters forms using forms and call ur report form there

  • How to make a installer for iphone application

    hi, dear all, I have made a iphone application by XCode , it can running perfect on emulator . I want it can be install on real device , how to do it ? how to make a installer for my iphone application ?
    thanks to your response .

    If you go to the iPhone DEV area on Apple.com you can get a installer app once you are a developer. This installer will let you use apps for your own use. This installer app also supports up to X amount of phones you can install the application on. I thought it was set at 100 but could be now up to 500.

  • How to make a wall for a game

    hello developers
    I’m sharing a long time to find out how to make a wall for my game but now where is it.
    Can someone help me?
    its a wall for an iphone/ipod game.
    It must be a wall that a sprite will stop walking it’s not a killer object but a stop object.
    oh and are there differants in programing in ipad/iphone?
    Thanks for help
    Grtz Jimmy

    I don't know what's you point on the wall and the player but you should do something as that:
    -(IBAction)goLeft
         if (player.x > wall.xo && player.x < wall.xI)
                  // you are in the wall go right
              if(player.y > wall.yo && player.y < wall.yI)
                 // you are in the wall go right
                 player.x ++;
              else ; // you are up or down of wall
    -(IBAction)goRight
        if (player.x > wall.xo && player.x < wall.xI)
              if(player.y > wall.yo && player.y < wall.yI)
                 // you are in the wall go left
                 player.x --;
               else ; // you are up or down of wall

  • How to make a program for backgroung processing used servlet

    how to make a program for backgroung processing used servlet

    well i need the coding part written in servlet ,in which servlet is always ready for accepting a client request.

  • How to make exception rules for Stylish rules which change fonts?

    How to make exception rules for Stylish rules which change fonts?
    I use [https://addons.mozilla.org/en-US/firefox/addon/stylish/ Stylish add-on] to change specific fonts to other fonts of my choice, but I have a problem. I want to change the font Arial to Tahoma in almost all pages I visit, but with the exception of websites as wikipedia.org. Because of this, I find myself having a very long list of domains to change Arial to Tahoma, only because I don't want that rule to apply to wikipedia.org and additional one or two other websites.
    The current rule I'm using is, (my actual list is a lot longer, but this is just an example):<br/>
    '''''@-moz-document domain("mozilla.org"), domain("thefreelibrary.com"), domain("sil.org"), domain("ethnologue.com") {'''''<br/>
    '''''@font-face { font-family: 'Arial'; src: local('Tahoma'); }'''''<br/>
    I can't use the following rule because I don't want it to apply to wikipedia.org:<br/>
    '''''@font-face { font-family: 'Arial'; src: local('Tahoma'); }'''''

    Try something like this:<br />
    <br />
    <pre><nowiki>@font-face { font-family: 'Arial'; src: local('Tahoma'); }
    @-moz-document domain(wikipedia.org){
    @font-face { font-family: 'Arial'; src: local('Arial'); }
    </nowiki></pre>

  • How to make itunes account for free

    how to make itunes account for free?

    Since you're posting here, you already have an Apple ID. Click here and follow the rest of the instructions.
    (93518)

  • How to make resizable false for JcomboBox

    hi ,
    I am using JCombobox , but it resizes when length of data inside it is
    increses.I am in trouble because of that.
    Would anybody how to make resizable false for Jcombobox
    --Harish                                                                                                                                                                                                                                                                                                                                                                                   

    Set a preferred size on the combo box, e.g.
    box.setPreferredSize(new Dimension(150,box.getPreferredSize().height));

  • How to make font larger for turbo tax

    how to make font larger for turbotax

    There doesn't appear to be a setting in TurboTax to make the font bigger.
    But you can go to Applications/System Preferences/Displays/Display and pick Resolution:Scaled and experiment with different resolutions, which will make the fonts look bigger.
    There are also zoom settings in System Preferences/Accessibility/Zoom.

Maybe you are looking for

  • General Error or Crash using menu button on chapter playlists

    This is my first complex project in 2.0 - I needed to have approx 120 clips playable individually from a series of still menus. Given the 99 timeline limit, I created a number of timelines and placed batches of clips on them. I'm then using individua

  • Count of Rows - Meaure

    Hi There, I am trying to create a measure in cube browser which will return count of rows of a table. If there are some rows, it returns correct result but in other case if table is empty, it returns nothing. I want to return 0 in later case. Please

  • XFCE opening folders in Firefox instead of Thunar

    If I do something like select Dropbox's "Open Dropbox Folder" or choose to "Open containing folder" of a downloaded file in Chromium, Firefox starts up and displays the folder contents (as a directory listing). This is baffling for a number of reason

  • Spiegel app 2 mal in Rechnung gestellt?

    Beim Einkauf im app-store wurde mir der Spiegel (Zeitschrift) 2 x in Rechnung gestellt. über die Anleitung: Probleme mit Einkäufen melden - komme ich nicht weiter, weil meine Fenster nicht das aufzeigen was in der Anleitung vorgesehen ist. MacBookPro

  • How to set different bgcolors for rows int HtmlDatatable?

    I have JSF HtmlDataTable on my page. I need to fill rows in table by different colors, according to row's data, but I can't find any method for it...... Should I use JavaScript in this case?