|
Happy to help.
I would move the GetCategories query to another template,
say GetCategories.cfm, including the code to set the session variable. Instead
of using session scope, change it to request scope and remove the cflock since
it won't be needed with the request scope. The request scope is better because
it gets destroyed when the page is done loading and it sounds like your data
will change for each page request so no need to persist it and eat up RAM on the
server.
Then, in SiteNav.cfm and anywhere else you refer to
request.GetCategories, do this just prior to referencing it:
<CFIF NOT IsDefined("request.GetCategories") OR
NOT IsQuery(request.GetCategories)>
cfinclude or cfmodule the GetCategories.cfm template to populate the request.GetCategories result set </CFIF>
That will keep it from breaking if you happen to not have a
call to SiteNav.cfm in particular pages. Even better would be to have the query
in a function in a cfc, but it's time for me to go home now so I've got to stop
typing.
Best of luck!
Scott
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dan Sent: Thursday, May 05, 2005 5:29 PM To: [email protected] Subject: RE: [plum] Query of Query Thank you Scott. !!!
A quick copy and paste to test AND IT WORKS. Now to refine it if I can. I don’t need elegant right now, just a working app. (my wife says I look elegant in a Tux, but I prefer a T-Shirt and Shorts)
Ironically I was headed in the direction of your reasoning—that my first query was outside the scope of something. I was about to try caching the query, but something tells me that wouldn’t have worked.
Dan
-----Original
Message-----
Greetings Dan, Since you run the first query in a template called by cfmodule and not cfinclude, the result set is out of the scope of the rest of the page. A quick fix would be to load the result set into the session scope by doing something like the following in SiteNav.cfm after the cfquery:
<CFLOCK
TIMEOUT="30" THROWONTIMEOUT="No" TYPE="EXCLUSIVE"
SCOPE="SESSION">
You can then do your QoQ on the query "session.GetCategories" and it should work just fine.
That's nowhere near an elegant solution, but it'll work...
HTH! Scott From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dan Hi there Plummers,
Struggling again. Hope there’s someone out there who can re-point me in the right direction.
On my Header.cfm page I have near the top a CFmodule call for the SiteNav bar.
In the SiteNav.cfm page for the bar I run a fairly fancy SQL query to get the Nav Items from a couple of tables. No problem here—it works very well.
A little further down the page I have a “PageBar” that will show the “CategoryName” and the “PageName” ( A Category can/will have multiple pages) Only the CategoryName(s) appear in the SiteNav bar at top. The PageNames are used in the PageBar and below that in a “subNav menu”
I need the PageBar to change values displayed as a site visitor clicks/selects CategoryName(s) from the SiteNav bar.
Since I’ve already run a query that has all the CategoryNames and PageNames, my reasoning was that all I needed to do was run a Query of Query on the “GetCategories” query that populates the SiteNav bar, by passing to it (the QoQ) the CategoryID and have my WHERE clause simply say WHERE CategoryID = #URL.Cat#
It seems to make logical sense to me.
But I am getting an error that says my first query “GetCategories” can’t be found in memory.
Here’s some code snippets: (this is all in header.cfm)
<!-- #SiteNav --> <cfmodule template="#request.layout#/SiteNav.cfm" pageType="#Attributes.pageType#">
…then a bit further down the page…
<!--- #PageBar ---> <div id="PageBar">
<CFinclude template="../../qry/BCC_qry_GetPageBarLabels.cfm"> <cfoutput query="GetPageBarLabels"> <span class="PageTitle">#GetPageBarLabels.PageName#</span>
GetPageBarLabels.cfm is my Query of Query on GetCategories
and over on SiteNav.cfm I have (in part)
<CFcase value="Public"> <CFset RoleCode ="Public"> <CFinclude template="../../qry/BCC_qry_GetCategories.cfm"> <cfoutput query="GetCategories"> <li><a href="" #GetCategories.CategoryName#</a></li> </cfoutput>
If you can figure out what I’m describing here, can you tell me why not the GetCategories query would not be in memory?
Thanks,
Dan Kaufman
An Elephant Never Forgets
-- -- -- -- |
- [plum] Query of Query Dan
- RE: [plum] Query of Query Scott Krebs
- RE: [plum] Query of Query Dan
- Re: [plum] Query of Query Jeff Fleitz
- RE: [plum] Query of Query Dan
- Re: [plum] Query of Query Jeff Fleitz
- RE: [plum] Query of Query Dan
- Re: [plum] Query of Query Jeff Fleitz
- RE: [plum] Query of Query Dan
- RE: [plum] Query of Query Scott Krebs
