locatepage issue
Hello,
I'm seeing some inconsistency's with the locatePage tool. For our
primary navigation we've always used this code to allow both the
pages in the folder as well as the index of a subfolder to appear.
This has worked great for us since we went live with Cascade
Server, however the locatePage is showing invalid results because
${path}/index does not exist in the navigation but the locatePage
tool is saying that it does. In working in our qa environment,
which is a weekly clone of our production system, the issue also
exists very sporadically so I'm at least able to test it out and
debug it. I was able to 'fix' it within one site by creating a new
base folder and then copying each of the pages into it and the
navigation once again worked in the new folder as expected. Is it
possible to 'rebuild' or 'clear' the cache of the internal
indexing?
#set ( $folderCheck = $_.locatePage("${path}/index", $currentPageSiteName))
#if($folderCheck)
<li><a href="${path}/index">${title}</a></li>
#else
<li><a href="${path}">${title}</a></li>
#end
Discussions are closed to public comments.
If you need help with Cascade CMS please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Eric on 29 Apr, 2014 11:15 PM
I also tried this as one of the suggestions with no success:
How do I rebuild my search indexes?
Search indexes can be rebuilt by following these steps:
Click System Menu -> Utilities -> Search Indexing Confirm that your Index Location is correct (this director...
2 Posted by Ryan Griffith on 30 Apr, 2014 12:40 PM
Hi Eric,
I have a few questions to see if we can narrow things down a bit:
$folderCheck
, what is returned for the pages that do not exist? Are you seeing the variable dumped back out?Please let me know if you have any questions.
Thanks!
3 Posted by Eric on 30 Apr, 2014 01:04 PM
For the invalid pages when outputting $folderCheck I see: com.hannonhill.cascade.api.adapters.PageAPIAdapter@796d1af5 as well as when I output the info from the PropertyTool, it shoes all of the available methods on the invalid page.
We are running cascade server 7.8.3 and have been for a few months.
4 Posted by Ryan Griffith on 30 Apr, 2014 03:33 PM
Thank you for the additional information, Eric.
When you have a moment, I would like to rule out a possible known defect by performing the following steps:
Please let me know if you have any questions.
Thanks!
5 Posted by Eric on 30 Apr, 2014 05:58 PM
Hi Ryan,
That's the problem, the folder/page that the locatepage is finding doesn't truely exist from what I can see.
I'm attaching a screenshot to hopefully help explain the issue.
The reference it is finding is a folder called seminar with an page inside of it, so the full path would be phd/seminar/index, however from the screenshot you can tell that does not exist
What I did try was
1) Within the folder giving me issues I did what you said, edit the page "seminar", submit and the issue remains
2) moved/renamed the phd folder to phd2 and the issue remains
3) copied the entire folder to phd3 and the issue remains
4) edit the folder itself and hit submit and the issue remains
5) created a new folder called phd4 and then copied the 3 pages and the external link into it and the new folder works correctly.
6) in our production instance I made this code change as a temporary fix as well so we are no longer production impaired however it does cause the navigation to take longer to load now.
I realize 5) and 6) are both 'fixes' for the time being however it would still be nice to know what the root cause of the issue is.
6 Posted by Ryan Griffith on 30 Apr, 2014 06:51 PM
Hm, that is definitely interesting. When you have a moment, would you be willing to attach your entire Format so I can take a closer look and do some local testing?
Thanks!
7 Posted by Eric on 30 Apr, 2014 07:51 PM
Attached is the format. I think I'm able to re-create the issue as well.
Based on the folder/page structure of /graduate/course-worksheets/index it is currently picking up the index page with the attached format correctly, however this will break it.
1) Copy the page /graduate/course-worksheets/index to /graduate/course-worksheets1
2) The attached format now locates a page of /graduate/course-worksheets1/index which does not exist.
However, if I created a new page of /gradaute/some-page it would work as expected.
8 Posted by Ryan Griffith on 30 Apr, 2014 08:34 PM
Thank you for providing the Format, Eric.
I'm not sure if I am following your example; however. You mentioned copying
/graduate/course-worksheets/index
to the folder/graduate/course-worksheets1
in your first step, but state the page should not exist in your second step. If you are copying the page to the folder, we should expect it to exist, correct?Please let me know if I am missing something there.
Thanks!
9 Posted by Eric on 30 Apr, 2014 08:39 PM
Hi Ryan, sorry in that last step I'm copying the page "index" to the page "course-worksheets1" (not folder) in the /graduate-folder/ .
10 Posted by Ryan Griffith on 30 Apr, 2014 09:09 PM
Thank you for confirming, Eric.
I was able to reproduce this behavior locally, and I believe I may have narrowed things down a bit. I noticed that if you output
$folderCheck.identifier.id
before the check, the pages that "don't exist" seem to be repeating the same Page ID. This means that the$folderCheck
variable isn't being set properly, or reset for that matter.When you have a moment, try adding
#set ($folderCheck = false)
at the very bottom of the#foreach
that loops over the folder's children. This essentially resets the variable at the end of the loop. So you should see something like the following:Let me know how this change works out for you.
Thanks!
11 Posted by Eric on 30 Apr, 2014 10:17 PM
That appears to have corrected our code, thank you very much as always!
12 Posted by Ryan Griffith on 01 May, 2014 11:47 AM
Thank you for following up, Eric. I am glad to hear the change did the trick.
I have seen something like this before, where the variable needed to be "reset" after a loop, I think this is a Velocity thing. I am not 100% sure if it's a bug or just a caveat with the way Velocity handles variables.
I'm going to go ahead and close this discussion, please feel free to comment or reply to re-open if you have any additional questions.
Have a great day!
Ryan Griffith closed this discussion on 01 May, 2014 11:47 AM.