Quick Nav:  Online Store   |   Login | Register
PrevPrev--NextNext
Using Conditional Rules
Last Post 22 Apr 2009 01:58 PM by nicof. 3 Replies.
Please Register to participate.
Sort: Print topic: Printer Friendly
AuthorMessages
John Mitchell
Veteran Member
Posts:4384

Avatar

Administrator
Send PM:Send Private Message

--
01 May 2008 04:59 PM

Using Conditional Rules

A conditional rule basically consists of a special function type of PageBlaster token syntax that allows an IF condition to be evaluated before executing the rules that it contains.  The syntax of an IF function is as follows:

[PB: IF(expression1 evaloperator expression2 )  {true condition }else{false condition} ]

Where:

expression1: can be a literal term or the result of an inner function
   Inner functions are:  
                        Match ( expression1, expresion2 )  where expression2 can use regular expressions
                        Len (expresion1)
                        Left (expresion1,length)
                        Right (expresion1,length)
                        Substring(expresion1, start, length)

evaloperator: can be any of the following operators:   =, == , != , <> , >=, <=, <, >
    equals, not equals, greater than or equal to, less than or equal to, less than, greater than

expression2: same as expression 1

Expressions can be literal or you can use PB: tokens
The condition statements are enclosed in curly braces
The eval operator and expression are optional if you are using an inner function that evaluates to true or false.
The else part with the false condition is optional

So an example conditional statement that could be used to match on a Url and do a 301 redirect would look like this:

[PB: IF(  Match("[PB:Request.Url]","http://snapsis.com")  ) {

     [PB: Response.Status("301 Moved Permanently") ]

     [PB: Response.AddHeader("Location","http://www.snapsis.com") ]

     [PB: Response.End() ]

} ]

nicof
New Member
Posts:5


Send PM:Send Private Message

--
20 Apr 2009 07:52 AM
Hi John,

I'm looking for a way to move the title to the top of the head section, for SEO reasons only.
Now it appears at the bottom, it should be the opposit.
I'm sure it's a nooby question and there is a simple solution, anyway I don't get it right... ;-)
John Mitchell
Veteran Member
Posts:4384

Avatar

Administrator
Send PM:Send Private Message

--
21 Apr 2009 10:00 AM
To move the title node to the top of the head section:

Search For:
(<head[^>]*>)(.*?)(<title>.*?</title>)

Replace With:
$1$3$2
nicof
New Member
Posts:5


Send PM:Send Private Message

--
22 Apr 2009 01:58 PM
Hey John,

Works perfect. Thanks a lot for the fast support!
Please Register to participate.

Active Forums 4.1
     
      
Powered by: Snapsis Software