Foswiki/DBCachePlugin %TOPICTITLE% misbehavior?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Foswiki/DBCachePlugin %TOPICTITLE% misbehavior?

Paul L. Merchant Jr.
Hi everyone, I need some advice in using the %TOPICTITLE% macro in the results of a DBQUERY.  I have a simple query to show the 10 most recently modified topics and their titles:

%DBQUERY{
 "^."
 web="%BASEWEB%"
 type="regex"
 scope="topic"
 nonoise="on"
 sort="modified"
 limit="10"
 reverse="on"
 header="<ul>"
 format="<li><a href=\"%SCRIPTURL{view}%/$web/$topic\">$topic - $percntTOPICTITLE{$web/$topic}$percnt</a></li>"
 footer="<li>[[$percntBASEWEB$percnt.WebChanges][$percntMAKETEXT{\"(more...)\"}$percnt]]</li></ul>"
 separator=" "
}%

This works fine as long as the topic in which it appears does not have it's own title.  If I set the topic title with a preference like this:

   * Local TOPICTITLE = My Custom WebHome Topic Title

then that title is displayed for all the topics in the list.  It doesn't matter whether any of the topics have their own TOPICTITLE preference or not, the page's title id still displayed.

I suspect this is an unintended behavior due to the way preferences are inherited and the way DBCachePlugin uses the preference module to retrieve the title, but maybe I'm doing something wrong, or maybe there's an alternative that might work?  Ultimately I want this list to appear in a WebHome topic and I want the topic to have a particular title different from WebHome.

Thanks for any advice you can offer me.

— Paul
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Foswiki-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/foswiki-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Foswiki/DBCachePlugin %TOPICTITLE% misbehavior?

Michael Daum-2
Hi Paul,

Right. You effectively redefined the %TOPICTITLE% macro. That's exactly why there is a
%GETTOPICTITLE% macro as well.

So your format line could be rewritten like this:

format="<li><a href=\"%SCRIPTURL{view}%/$web/$topic\">$topic - $percntGETTOPICTITLE{$web/$topic}$percnt</a></li>"

or simply

format="<li>[[$web.$topic]]</li>"

in case you don't mind the extra $topic. The simples would be

%DBQUERY{
        "^."
        web="%BASEWEB%"
        sort="modified"
        limit="10"
        reverse="on"
        format="   * [[$web.$topic]]"
}%

Note that the three  type="regex",  scope="topic", nonoise="on" arent required, probably left-overs from converting a %SEARCH
to %DBQUERY...

Michael.


--
-- Michael Daum Consulting
-- Wissensmanagement und Intranet-Technologie
-- https://michaeldaumconsulting.com
-- Tel: +49 (0)40 21 99 27 51

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Foswiki-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/foswiki-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Foswiki/DBCachePlugin %TOPICTITLE% misbehavior?

Paul L. Merchant Jr.
Hi Michael, first, thanks!  This was exactly what I was looking for, and now that you mention it I vaguely recall seeing this discussed here about a year ago.  And yes, you're correct, I did simply blindly translate a %SEARCH%.  Shame on me for not taking the time to do a thorough job.

I wonder if this might be an appropriate documentation enhancement?  I haven't found any mention of %GETTOPICTITLE% except for this support question: https://foswiki.org/Support/Question1363.  Meanwhile, the documentation for %TOPICTITLE% describes its syntax as %TOPICTITLE{"<topic>"}%, explaining that it will return the topic's title:
        • from a TOPICTITLE preference variable, or
        • from a "TopicTitle" formfield attribute, or
        • defaults to the topic name
(https://foswiki.org/Extensions/DBCachePlugin)

A naive user like myself who isn't as fluent in Foswiki's preferences as one might like could misunderstand this to mean that if a topic doesn't have a preference set that one of the other forms might be tried.  That's not exactly how it works, however, and without any mention of GETTOPICTITLE, well, it's confusing.

Have I missed something in the documentation, and if not, would you consider adding a brief description of GETTOPICTITLE?  It's too useful to keep a secret.

Thanks again for the help!

— Paul

> On Jun 8, 2016, at 3:53 PM, Michael Daum <[hidden email]> wrote:
>
> Hi Paul,
>
> Right. You effectively redefined the %TOPICTITLE% macro. That's exactly why there is a
> %GETTOPICTITLE% macro as well.
>
> So your format line could be rewritten like this:
>
> format="<li><a href=\"%SCRIPTURL{view}%/$web/$topic\">$topic - $percntGETTOPICTITLE{$web/$topic}$percnt</a></li>"
>
> or simply
>
> format="<li>[[$web.$topic]]</li>"
>
> in case you don't mind the extra $topic. The simples would be
>
> %DBQUERY{
> "^."
> web="%BASEWEB%"
> sort="modified"
> limit="10"
> reverse="on"
> format="   * [[$web.$topic]]"
> }%
>
> Note that the three  type="regex",  scope="topic", nonoise="on" arent required, probably left-overs from converting a %SEARCH
> to %DBQUERY...
>
> Michael.
>
>
> --
> -- Michael Daum Consulting
> -- Wissensmanagement und Intranet-Technologie
> -- https://michaeldaumconsulting.com
> -- Tel: +49 (0)40 21 99 27 51

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Foswiki-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/foswiki-discuss