Javascript Awesome Shortcode
<script>
if (age == 18) {
document.getElementById(“demo”).innerHTML = “I am younger!”;
}
</script>
=====================================
<script>
var x = 5;
if (x != 8) {
(true) Statements here!
}
</script>

==================================
<script>

var x = 5;

if (x >= 8) { (false) Statements here!

}

</script>

==================================

<script>

var x = 5;

if (x > 3) { (true) Statements here!

}

</script>

 

==================================

 

<script>

var hour = new Date().getHours();

var greeting;

if (hour <= 18) {

greeting = “Good day”;

} else {

greeting = “Good evening”;

}

</script>

Ex. result = (hour <= 18) ? “Good day.” : “Good evening.”;

=====================================

<script>

var x = 3;

if (x < 5) { (true) Statements here!

}

</script>

 

==================================

 

 

 

 

 

 

</script>

var greeting;

var time = new Date().getHours();

 if (time < 10) {

greeting = “Good morning”;

} else if (time < 20) {

greeting = “Good day”;

} else {

greeting = “Good evening”;

}</script>

 

</script>

var greeting;

var hour=””;

var time= 5;

if (time == 5 && hour==””) {

greeting = “Good morning”;

}

</script>

[if.equal lhs=”{template.status}” rhs=”approved”]

[/if.equal]

[if.and empty=”{template.admission_meta.student_id}”]

[template.set is_student=”no” /]

[/if.and]

==================

[if.not_equal lhs=”{template.age}” rhs=”18″]

[/if.not_equal]

[if.and cond='{module.y}’ not_equal='{request.a2}’]

we are not equal

[/if.and]

<script>

var x, text;

x = document.getElementById(“numb”).value;

 

if (isNaN(x) || x > 1 || x < 10) {

text = “Input not valid”;

} else {

text = “Input OK”;

}

document.getElementById(“demo”).innerHTML = text;

</script>

[if.not_num template.arg]

[/if.not_num]

[if.greater_than lhs=”{x}” rhs=”1″]

[/if.greater_than]

[or.less_than lhs=”{x}” rhs=”10″]

[/or.less_than]

[if.else]

text = “Input OK”;

[/if.else]

I need to resolve this:

https://mj.wordpoets.com/wp-admin/post.php?post=578469&action=edit

re re
[if.equal lhs=”{template.age}” rhs=”18″]

[/if.equal]

[if.or cond='{module.x}’ equal='{request.y}’]

we are also equal

[/if.and]

========================================

[if.greater_equal lhs=”{module.found_posts}” rhs=”1″]

[/if.greater_equal]

[if.less_than lhs=”{module.blogs.found_posts}” rhs=”1″]

Not found

[/if.less_than]

[if.contains needle=”third” haystack=”first,second,third,fourth,fifth”]

[aw2. get template.contains_string]

[/if.contains]

[if.not_contains needle=”xyz” haystack=”{template.comma_separated_str}”]

[aw2. get template.not_contains_string]

[/if.not_contains ]

========================================

[if.equal lhs=”{template.arg}” rhs=”0″]

[aw2.get template.if_string /]

[/if.equal]

[if.else]

[aw2.get template.else_string /]

[/if.else]

[module.set space=” ” /]

[if.whitespace module.space]

This will execute

[/if.whitespace]

========================================

[module.set space=” ” /]

[if.not_whitespace module.space]

This will not execute

[/if.not_whitespace]

[if.yes {template.arg}]

[aw2.get template.yes_value /]

[/if.yes]

========================================

[if.no {template.arg}]

[aw2.get template.no_value /]

[/if.no ]

Note: If provided variable is yes or no then executes

[if.not_empty module.res.posts]

[module.res.posts dump=t /]

[/if.not_empty]

========================================

[if.empty module.res.posts]

[aw2.get template.empty_string]

[/if.not_empty]

[if.odd {template.arg}]

[aw2.get template.odd_string]

[/if.odd]

=====================================

[if.even {template.arg}]

[aw2.get template.even_string]

[/if.odd]

[if.greater_than_zero template.arg]

[aw2.get template.arg /]

[/if.greater_than_zero]

[if.user_can]

[aw2.get current_user dump=t /]

[/if.user_can] 

=====================================

[if.user_cannot]

[aw2.get current_user dump=t /]

[/if.user_cannot]

Note: Whether a user have capability or role

Consider following condition of &:
var age = 18
if(age > 5 && age < 20){
print(“Age is verified”);}
In awesome this is represented as:

Explaination:

  • In awseome we have to consider AND or OR condition in separate condition shortcode.
  • both the condition works as one as we write in PHP or JS.
  • same there will be more possibility of extension is c.<condition>

E.g:

  • this will executes when age is not_empty.
  • Please consider this and try to implement in your code for better understanding.
  • there are more conditions for c.<cond>
  • check env variable in enterprise to get more options.