Link to home
Start Free TrialLog in
Avatar of Eric Bourland
Eric BourlandFlag for United States of America

asked on

question: using CFIF to modify Parent navigation menu

Hi. I am trying to modify a navigation menu. This nav menu displays links to parent and children pages. I want to change the links of two of the parent pages: PageID=11 and PageID=12.

* I need the link to PageID=11 to point to, not to

* And I need the link to PageID=12 to point to javascript:launchWS('');, not to

The current query and HTML, below, almost work. But right now, parent menu items Blog and Boutique appear twice. My client is a little impatient. =) How can I get rid of the extra parent navigation menu links?

Thanks for your advice as always. Eric B


<cfparam name="url.PageID" default="1" />

<!--- this query will retrieve all records --->  
<cfquery datasource="#ds#" name="qry_GetPages">  
SELECT PageID, PageTitle, buddha_main, two_col_interior_left, two_col_interior_right, two_col_content_lower_page, right_col_menu_item, ParentID, SortOrder
FROM  tbl_buddhab_navigation  
<!--- this will retrieve just the parent records from the previous query --->  
<cfquery name="fetchTopNav" dbtype="query">  
FROM qry_GetPages  
WHERE ParentID = <cfqueryparam cfsqltype="cf_sql_integer" value="0" maxlength="2">
ORDER BY SortOrder  


<div class="menu">

<cfoutput query="fetchTopNav">  

	<li><a href="/index.cfm?PageID=#fetchTopNav.PageID#">#fetchTopNav.pageTitle#</a>

<cfif fetchTopNav.pageID IS 12>
	<li><a href="javascript:launchWS('');">#fetchTopNav.pageTitle#</a>

<cfif fetchTopNav.pageID IS 11>       
	<li><a href="/blog/">Blog</a>
  <cfquery name="fetchChildren" dbtype="query">  
    SELECT *   
    FROM qry_GetPages  
    WHERE parentID = <cfqueryparam value="#val(fetchTopNav.pageid)#" cfsqltype="cf_sql_integer">
    ORDER BY sortorder asc  
  <cfif fetchChildren.recordCount gt 0>  

        <cfloop query="fetchChildren">
     <!--- FETCH all children that are NOT PageID=19 --->
         <cfif fetchChildren.PageID IS 19>
 <li><a href="javascript:launchWS('');">#fetchChildren.pageTitle#</a></li>
 <cfelseif fetchChildren.PageID IS 29>
         <li><a href="javascript:launchWS('');">#fetchChildren.pageTitle#</a></li>

        <li><a href="/index.cfm?PageID=#fetchChildren.PageID#">#fetchChildren.pageTitle#</a></li>



Open in new window

Avatar of _agx_
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Eric Bourland


This worked like a charm. =) And I see what I was missing. Thank you _agx_.

Sweet. Client is happy.

Eric B
I applied the same procedure to another web site to resolve a problem with navigation menu formatting. Thank you again. =) Hope your day is going well. EB