I want to use &highlightResults as shown in the RTFM to add a class to the keywords that appear in the results. However, this doesnt seem to work.
My snippet call looks like:
[[!SimpleSearch?
&ids=`21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,44,22`
&idType=`parents`
&tpl=`SearchResultTpl2016`
&containerTpl=`SimpleSearchContainerTpl`
&highlightResults=`1`
&includeTVs=`1`
&processTVs=`1`
&showExtract=`1`
]]
I tried adding:
&highlightClass=`sisea-highlight`
&highlightTag=`span`
as well but it made no difference.
Would anyone know what I'm doing wrong here?
Related
I'm trying to output a template variable inside the if statement in ModX, but it gives no output.
I have multiple pages with links to articles and the point is to only output template variable content on the first page but not the others.
// This gives no output:
[[!#get.page:is=`1`:or:is=``:then=`[[*content]]`:else=``]
// This outputs "yes" on the first page and "no" on others:
[[!#get.page:is=`1`:or:is=``:then=`yes`:else=`no`]]
I've even tried this, but it still does not give any output. I guess the problem is not about the output modifier:
[[!#get.page:is=`1`:or:is=``:then=`[[*content]]`:else=`[[*content]]`]
I'm using ModX Revo 2.7.0
Any help is appreciated, thanks in advance!
Actually in your case missing a double closing angle bracket "]]"
[[!#get.page:is=`1`:or:is=``:then=`[[*content]]`:else=``]]
The `or:is=` is matching against an empty state. Unless that is intentional you should be able to remove it. Also, the `:else=`` is the default state, so, you don't need that either.
The following should work and you'll have cleaner code:
[[!#get.page:is=`1`:then=`[[*content]]`]]
I try to hide the getPage [[+pageNav]] Placeholder if there is no pagination. But I can't do the following.
[[!+pageNav:notempty=`<ul class="overview__pagination">[[!+pageNav]]</ul>`]]
Does someone know how I can hide the element with an apropriate output filter? (without own extra snippet). I also tried the following and some other (not likely to work variations).
[[!+pageNav:isnot=``:then=`<ul class="overview__pagination">[[!+pageNav]]</ul>`]]`
Are you calling that code in a chunk that is cached?
Otherwise i've experienced this aswell and it seems custom placeholders sometimes behave that way, it's probably due to the fact that they actually have some unprocessed value during the IF computation but when it's actually output you see nothing. Or that the value is somehow "null" instead of "" while modx output filter might do a strict comparison.
If you're not calling it in a cached chunk or part of code, i suggest first trying with another getPage placeholder such as pageCount or total.
Like:
[[!+pageCount:gt=`1`:then=`<ul class="overview__pagination">[[!+page.nav]]</ul>`]]
If that still doesn't work, a last resort in the form of a simple snippet will always solve it, like:
[[!outputPagination? &total=`[[+total]]` &limit=`XX` &output=`<ul class="overview__pagination">[[!+page.nav]]</ul>`]]
In snippet:
if ($total > $limit) {
return $output;
}
Shouldn't it be...
[[!+page.nav:notempty=`<ul class="overview__pagination">[[!+page.nav]]</ul>`]]
Well, there is a much more easier way to do it than in the first answer. It's like TheMistaC says, even if my answer is a lot easier:
[[!+page.nav:notempty=`
[[!+page.nav]]
`]]
I use it to display a list of articles with getResources, so I know this works fine.
Reading the documentation, I'm led to believe Google Docs should be able to handle if-statements in the following format (straight from the documentation):
IF(test, then_value, otherwise_value)
So, as a test, I try the following:
=IF(2>1, 2, 1)
This should obviously print 2 since two will always be greater than one. However, this throws me an error. So, I try the following instead:
=IF(1=1, 1, 1)
This also gives me an error.
Obviously I'm doing something wrong here, unless Google stopped supporting if-statements in their docs. Can anyone help?
Google has obviously changed this without changing the proper documentation. According to the documentation, as of writing this, the correct way to do this is as in my question:
=IF(2>1, 2, 1)
However, if you start writing "=IF" in Google Drive, a popup guides you in the correct direction, and it seems they have changed the syntax to:
=IF(2>1; 2; 1)
Note the use of semicolons instead of commas. That's it.
can somebody tell me how to use wildcards in the router table of node-http-proxy?
for example for wildcard subdomains, something like *.domain.de
i know there are RegEx used but i cant get it to work.
i tried like
'([a-zA-Z0-9_]).domain.de': '127.0.0.1:8085',
and
'([^.]*).domain.de' : '127.0.0.1:8085'
but none seem to redirect.
I've not done this myself but I would think that the whole string needs to be a regular expression. So it would be something like:
'[a-zA-Z0-9_]\.domain\.de': '127.0.0.1:8085',
Note the escaping of the dots. In fact, this would be simpler (though perhaps not as secure) if that format is correct:
'.*\.domain\.de': '127.0.0.1:8085',
Or even:
'\w*\.domain\.de': '127.0.0.1:8085',
Sadly, and as usual with all things Node, you are expected to "know" this stuff - mainly by reading the source code :( This is one of the key issues that puts me off using Node in the real world.
By default, the wayfinder plugin in modx revo should sort by menuindex. This doesn't seem to work. I have the following:
[[!Wayfinder? &startId=`2` &level=`1` &ignoreHidden=`TRUE` &outerClass=`news` &sortBy=`menuindex` &sortOrder=`DESC`]]
I suspect it's something stupid I overlooked...
EDIT: I've made it work now.
I looked into the wayfinder code in wayfinder.class.php. The following line was commented out:
$c->groupby($this->modx->getSelectColumns('modResource','modResource','',array('id')));
It happened because of the following comment in the code:
/* not sure why this groupby is here in the first place. removing for now as it causes issues with the sortby clauses */
Maybe this will help someone in the future.
I looked at the wayfinder code in wayfinder.class.php The following line was commented: $c->groupby($this->modx->getSelectColumns('modResource','modResource','',array('id')));
It was commented out because of the following comment in the code:
/* not sure why this groupby is here in the first place. removing for now as it causes issues with the sortby clauses */
Maybe this helps anyone in the future