User Tools

Site Tools


pub:vfexpression

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pub:vfexpression [2018/05/24 23:06] (current)
Line 1: Line 1:
 +<​html>&#​091;</​html>​[[ iviewweb | Up To iView 5 Web Interface ]]<​html>&#​093;</​html>​
 +
 +
 +
 +
 +====== Using *EXPRESSION in Virtual Folders ======
 +
 +Using the *EXPRESSION rule type, you may key up to 1024 characters of valid Php code in the '​Comparison Value' field. iView 5 will feed this string to the Php eval() function and return its value.
 +
 +  * The code must be valid Php.
 +  * Do not enclose the code in quotes - eval() would evaluate that as a string and return NULL.
 +  * You may reference the archive index field value using the variable **$fieldValue**. You may want to trim() this value. ​
 +  * The code must use **return**, and should return TRUE, FALSE, ​ or something that the Php interpreter will evaluate to TRUE or FALSE.
 +  * **Prefix all variables you use**, except $fieldValue,​ with u_. Thus you might have variables named $u_firstChar. This is to avoid name conflicts.
 +
 +
 +Examples:<​html><​br/></​html>​
 +
 +<​html><​pre></​html>​
 +if( trim( $fieldValue ) == "Able Anderson"​ ) return TRUE; else return FALSE;
 +<​html></​pre></​html>​
 +<​html><​pre></​html>​
 +$u_firstChar = substr( trim( $fieldValue ), 0, 1 );<​html><​br/></​html> ​
 +if( $u_firstChar == '​C'​ || $u_firstChar == '​D'​ ) return TRUE; else return FALSE;
 +<​html></​pre></​html>​
 +
 +A rules specification for the above would look thus:
 +
 +{{pub:​iview:​vfexpression600.png|}}
 +
 +For more information see [[http://​us.php.net/​manual/​en/​function.eval.php]]
 +
 +<​html><​span style="​color:​ #9C0000; font-weight:​ bold;"></​html>​
 +The ability to paste any Php code into this field is a glaring security ​ and data integrity issue and administration of Virtual Folders should be restricted as appropriate.<​html></​span></​html>​
 +
 +<​html><​p></​html>​
 +
 +----
 +
 +<​html>&#​091;</​html>​[[ iviewweb | Up To iView 5 Web Interface ]]<​html>&#​093;</​html>​
  
pub/vfexpression.txt ยท Last modified: 2018/05/24 23:06 (external edit)