More than one 'And' operator in ASP if statment? - if-statement

Sorry I am new to ASP. I found a strange problem in the If statement
For example , I use this condition
if sear_type="4" and rs_search_news("search_field")="2" and show_str2<>1 then
....
Endif
And it is not work as expected . Is ASP not allow writing condition like this? Thanks

It should work just fine, probably something else is wrong.
Try this for start, and if still not working please explain exactly what's wrong.
If (sear_type="4") And (rs_search_news("search_field")="2") And (show_str2<>1) Then
'....
End If

Related

Google sheets - Conditional Formatting "less than" not working properly when used on range

t Hey guys, im getting mad about something really simple. Why does this plain conditional formatting light up the values 15 and 12? When applied only for cell D1 or F1 it works properly, I'm really clueless. Thank you for your advice!
Also my greetings got deleted everytime after saving the edit, I had to put a random letter in front so it got through, whats up with that random behaviour lol
instead of your:
=A1
use:
=$A1

simple if/else statement does not seem to be working, can anybody tell me what I am doing wrong?

I am trying to get a simple if/else statement working.
if the number given is bigger than 5 it should print statement A, if not it should print statement B.
It keeps printing statement A no matter what.
What am I doing wrong?
Thanks for your help.
snippet of code

Modx *id isnot =`` and isnot=`` not working

Hi can someone help me with the correct code for this statement because it is not working for me.
[[*id:isnot=`250` and isnot=`252`:then=`[[$qc-wrap]]`]]
A more performant syntax would be:
[[[[*id:isnot=`250`:or:isnot=`252`:then=`$qc-wrap`:else=``]]]]
Note: updated to reflect comment below. Include a hyphen in the else value, as this:
[[[[ ... :else=`-`]]]]
Also note: an empty else condition can be left off entirely.
I think using or rather than and is appropriate here.
This article is great for understanding MODX conditionals:
https://sepiariver.com/modx/modx-output-filters-if-phx-conditional-statements-tutorial/
And this one for understanding the syntax above and why it's more performant:
https://modx.com/blog/2012/09/14/tags-as-the-result-or-how-conditionals-are-like-mosquitoes/
You use wrong syntax, please fix as follows:
[[*id:isnot='250':and:isnot='252':then='[[$qc-wrap]]']]
Don't forget to replace ' with ` within this example
A simpler solution for this question is to use the :inarray output modifier to return an empty string, and use the :default output modifier to customize output for everything that doesn't match 250 or 252:
[[*id:inarray=`250,252`:then=``:default=`[[$qc-wrap]]`]]

regular expression to parse image url from a html code

Hello guys i wrote a module that creates some articles and css them properly and i want to parse the images from the Article content. The first thought came to my mind was the regular expressions. i didnt have any idea till 3 hours i started reading tutorials about regexp and i made a pattern that for me it seems kinda ok.
$pattern='^src\="images\/([a-zA-Z]+|[0-9]+)+([a-zA-Z]*|[0-9]*)*\.[jpg|png|bmp|gif]"$';
$regstring=$introtext;
preg_match($pattern,$regstring,$matches);
var_dump($matches);
INPUT:
<p>ASDADSDSASADSADSASDADSDSASADSADSASDADSDSASA</p>
<p><img src="images/authentic.jpg" alt="authentic" /></p>
<p>SASDADSDSASADSADSASDADSDSASADSADS</p>
I kinda found alot of ready patters in stackoverflow that are completly different than mine, and i didnt want to just copy some lines that i dont know what they do.Also i found out ten mins before that i can do that With DOM html , but im stubborn to make it work with regexpr so i can learn something more about it.
Can someone help me find what is my mistake/s ?
Thanks for your time.
src="images\/[a-zA-Z0-9]+\.(?:jpg|png|bmp|gif)"
You can try this.A simple version of your regex.See demo.
http://regex101.com/r/oE6jJ1/36
$pattern='/(?<=[\'\"])[\w\/-]+[.]{1}[a-zA-Z]{3,4}(?=[\'\"])/i';
$regstring=$introtext;
preg_match_all($pattern,$regstring,$matches);
var_dump($matches[0]);
you can see how this works here: http://regex101.com/r/eV6gE4/1
Use a proper solution, and please, stop killing kitties (every-time you try to parse HTML with regex, you kill a kittie) when you install perl module WWW::Mechanize, the command mech-dump become available :
$ mech-dump --images http://stackoverflow.com/questions/27151348
http://i.stack.imgur.com/qF63b.jpg?s=32&g=1
//cdn.sstatic.net/stackoverflow/img/apple-touch-icon.png
http://i.stack.imgur.com/nyAHT.jpg?s=32&g=1
/posts/27151348/ivc/677a
http://pixel.quantserve.com/pixel/p-c1rF4kxgLUzNc.gif

HTMLEditFormat Syntax Issues - XSS

I'm attempting to work on some possible XSS flaws in my code and have ran into some issues.
This code doesn’t work (line 297) - Syntax error:
#iif(HTMLEditFormat (not url.excludeFinalized),de(" disabled"),de("")) )#
This code does work (line 298):
#iif(HTMLEditFormat(url.excludeFinalized),de(" checked"),de("")) )#
This ‘not’ is what's messing me up - How would I properly place HTMLEditFormat into the code above or below?
#iif(not subgroupExercisesDone and nodeIsRollup,de("disabled"),de(""))#
Thanks for any help. I would greatly appreciate it!
I believe you need this change:
#iif((not url.excludeFinalized),de(HTMLEditFormat(" disabled")),de("")) )#
Your original code wraps HTMLEditFormat around a condition. And there's no need to HEF() and empty string, so you still have just one usage of HTMLEditFormat. I don't think you need HTMLEditFormat at all, to be honest.
I think. Didn't test this myself.
You can't put the NOT inside the function call like that.
This is more in line with what you were trying to do.
#iif(NOT HTMLEditFormat(url.excludeFinalized),de(" disabled"),de("")))#
But if HTMLEditFormat(url.excludeFinalized) can't be resolved as a Boolean value, you're going to get a runtime error.