[opencms-dev] Having fun with detail pages...

Claus Priisholm cpr at codedroids.com
Sun Nov 11 14:45:13 CET 2012


Further details:

Since I am using the v8list to generate the list of news on the detail page
the center_singlepage.jsp from that module is doing most of the work. I
have inserted some "debug" code to see why I don't get the "nice urls".

When I mimic the code in the <cms:link>-tag I get contradicting results:

I_CmsDetailPageFinder finder.getAllDetailPages()

does return my detail page when looking up detail pages for  v8news (only
one set up).

But finder.getDetailPage() returns null.

Trying a slightly different variation:

OpenCms.getADEManager().isDetailPage(cms.getCmsObject(),
cms.getCmsObject().readResource(cms.getRequestContext().getUri()))

returns true but

OpenCms.getADEManager().getDetailPage(cms.getCmsObject(), rootVfsName,
cms.getRequestContext().getUri());

returns null...

The first one makes a lookup in a configuration cache and obviously finds
it to be configured as a detail page (and the sitemap editor seems to agree
as it shows the page with the v8news icon rather than the normal container
page icon, as well as list the file/folder name + "(*v8news)")

Looking at the code for CmsADEManager.getDetailPage(CmsObject cms, String
pageRootPath, String originPath) there are two places where it can return
null. The second half looks up the detail page from CmsADEConfigData based
on the type, and I can verify that given "v8news" the CmsADEConfigData does
return the detail page I've set up.

So it seems that it is during the first part it either fails to find a
resource type or finds the wrong one:

 boolean online =
cms.getRequestContext().getCurrentProject().isOnlineProject();
 CmsConfigurationCache cache = online ? m_onlineCache : m_offlineCache;
 String resType = cache.getParentFolderType(pageRootPath);
 if (resType == null) {
     return null;
 }

Most methods on the CmsConfigurationCache are protected so I haven't probed
it but it does use the parent folder of the pageRootPath (in my example
/.content/v8news/v8news-00003.html) to lookup the type.

The /.content/v8news was a plain folder which I then changed to
"v8newsgallery" (which I can see what is used in the flower example), but
the result is the same - all listed links point to the .content/v8news
folder since the getDetailPage() continues to return null.

Any ideas what is missing?

Brs
Claus


2012/11/9 Claus Priisholm <cpr at codedroids.com>

>
> Well, not really...
>
> I am obviously overlooking something in the configuration since the
> example in the demo stuff is working.
>
> I have a detail page of type v8news inside a sub-site (such as /da/... ).
> The subsite map seems to be required as I otherwise cannot have a news
> detail page per locale.
>
> The news articles themselves reside in the /.content/v8news folder (common
> for all locales)
>
> I place a v8list element on the detail page and it lists the news
> articles, but the links are not rewritten to point to the detail page and
> instead in opens the "raw" news article with an error saying "This element
> can not be displayed correctly because there is no detail page configured
> for this type. Please create a type detail page for this type in the
> sitemap editor."
>
> Which is what I have done and it is also duely recorded in the
> /da/.content/.config file that there is a v8news detail page.
>
> Now since I was kind of surprised* to find that the configuration of the
> v8list needed to be repeated for each locale I am wondering if that also
> applies to the .config file. The examples I've looked at seems to suggest
> that this is always in "en" locale and it certainly did not help to add
> configuration for more locales - I still get links to the raw news article
>
> (* I was missing the mapping for the da locale and ended up with a lot of
> empty headlines and links in the list output because it was missing the
> mapping for that locale)
>
> The documentation I've stumbled upon seems to suggest that I am doing all
> that is needed, but still to no avail.
>
> Brs
> Claus
>



-- 
Claus Priisholm
+45 48 22 46 46
cpr (you know what) codedroids.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20121111/c41a7ba7/attachment.htm>


More information about the opencms-dev mailing list