Hi. I have what seems like a very basic question, but I can't quite get the solution. I have parent and child PageIDs in a table. I need to list ParentIDs by title. I can't quite get the right list of titles to display.
Query getPages queries the table for records:
<cfquery name="getPages" datasource="#APPLICATION.dataSource#">
SELECT PageID, PageTitle, DateCreated, DateModified, ParentID, SortOrder
Here is the output:
<!--- display record information --->
<td>#DateFormat(getPages.DateCreated, "mmmm d, yyyy")#</td>
<td>#DateFormat(getPages.DateModified, "mmmm d, yyyy")#</td>
<!--- if ParentID is 0, then web page is in top-level navigation --->
<cfif ParentID IS 0>
Top Level Navigation
<!--- if ParentID is 100000, then web page is omitted from navigation --->
<cfelseif ParentID IS 100000>
Not in Navigation
<!--- otherwise, display the Page Title of the record --->
#getPages.PageTitle#<!--- here is where I am stuck; this variable obviously displays just the PageTitle of the PageID, but I want to display the PageTitle of the PageID's ParentID --->
It is easy to display the PageTitle of a PageID: #getPages.PageTitle#. But I want to display the PageTitle of the PageID's ParentID.
Example: PageID 2 is web page "About Us", and has ParentID 0 because it is in top level navigation.
PageID 3 is web page "Staff", and has ParentID 2, because it is a child of PageID 2.
I want to display PageTitle "About Us" as the parent page for PageID 3, "Staff".
Do I need to use another query to make this happen? (I think I do.)
Thanks for reading.