Tags:
create new tag
view all tags

SID-00993: Formatted search syntax when calling variables

Status: Answered Answered TWiki version: 4.3.2 Perl version:
Category: CategorySearch Server OS: Last update: 15 years ago

Hi,

I'm trying to create a search which will list webs based on a parameter 'OWNER', but also have the same formatting as the traditional webs bar.

The following seems to work pretty well, but how can I pass the $web result from the search to the WEBBGCOLOR call?

%SEARCH{"OWNER = TWIKI" web="all" topic="WebPreferences" nonoise="on" format=" * <img src=\"%ICONURL{web-bg}%\" alt=\"boo\" style=\"background-color:%VAR{"WEBBGCOLOR" web=\"$web\"}%\" /> $web.WebHome"}%

Many thanks for any help

-- RobMathieson - 2010-10-11

Discussion and Answer

Escape the VAR so that it runs once per hit (not once before SEARCH runs). To escape a variable, escape the percent sign, e.g. $percntVAR{...}$percnt.

If you have many hits, repeated VAR look-up might be slow. You can address that if you store the web colors in CALC variables, and use them in the SEARCH format. Again, you need to escape the CALC with $percntCALC{...}$percnt.

More at VarSEARCH, FormattedSearch, SpreadSheetPlugin.

-- PeterThoeny - 2010-10-11

Thank you Peter.

Here is the same search with the correct syntax in case anyone wants it.

%SEARCH{"OWNER = TWIKI" web="all" topic="WebPreferences" nonoise="on" format="   * <img src=\"%ICONURL{web-bg}%\" alt=\"boo\" style=\"background-color:$percntVAR{\"WEBBGCOLOR\" web=\"$web\"}$percnt\" />  $web.WebHome"}%

-- RobMathieson - 2010-10-20

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
SupportForm
Status Answered
Title Formatted search syntax when calling variables
SupportCategory CategorySearch
TWiki version 4.3.2
Server OS

Web server

Perl version

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2010-10-20 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.