You are here

README.txt in Views PHP Filter 7

Same filename and directory in other branches
  1. 5 README.txt
  2. 6 README.txt
Module: Views PHP Filter
Author: George Nassar (george.nassar@gmail.com)


Description:
------------
Per a request in http://drupal.org/node/115947, Views PHP Filter effectively creates a Views Filter on criteria defined by a snippet of PHP.  This allows for much more powerful custom filtering on dynamically generated criteria.


Installation:
-------------
1. Copy the module directory into your 'modules' directory

2. Enable the module at 'administer >> modules'; it will appear under the Views category.


Usage:
------
A new filter, labeled "Node: Node ID", will appear as addablein your Views filter lists.  If you add that filter, you'll note the "Options" dropdown will have two choices: "PHP code" and "ID list".  "PHP code" will take a snippet of PHP as its value (without the <?php and ?> bracket tags), which should return an array of integers representing node IDs.  The filter will evaluate the PHP, and filter on the numbers in the return array.  "ID list" will simply take a list of numbers, separated by commas, and filter those node IDs.  This is currently used mainly for testing, but may survive to release if someone finds it useful.


NOTE:
-----

One should take caution in that the PHP code will be eval'd within the context of Drupal and Views.  This is a useful thing for power users, but can cause trouble if you're not expecting it.  For example, your code should not use variable names like $query unless you are actually intending to clobber the preexisting $query object.  Name your variables with this in mind.  A good safeguard if you aren't sure what you may or may not be clobbering is to give your all your variables some unique prefix -- say, start them all out with "$myvar_" or whatever you like.


Last updated: $Id$

File

README.txt
View source
  1. Module: Views PHP Filter
  2. Author: George Nassar (george.nassar@gmail.com)
  3. Description:
  4. ------------
  5. Per a request in http://drupal.org/node/115947, Views PHP Filter effectively creates a Views Filter on criteria defined by a snippet of PHP. This allows for much more powerful custom filtering on dynamically generated criteria.
  6. Installation:
  7. -------------
  8. 1. Copy the module directory into your 'modules' directory
  9. 2. Enable the module at 'administer >> modules'; it will appear under the Views category.
  10. Usage:
  11. ------
  12. A new filter, labeled "Node: Node ID", will appear as addablein your Views filter lists. If you add that filter, you'll note the "Options" dropdown will have two choices: "PHP code" and "ID list". "PHP code" will take a snippet of PHP as its value (without the bracket tags), which should return an array of integers representing node IDs. The filter will evaluate the PHP, and filter on the numbers in the return array. "ID list" will simply take a list of numbers, separated by commas, and filter those node IDs. This is currently used mainly for testing, but may survive to release if someone finds it useful.
  13. NOTE:
  14. -----
  15. One should take caution in that the PHP code will be eval'd within the context of Drupal and Views. This is a useful thing for power users, but can cause trouble if you're not expecting it. For example, your code should not use variable names like $query unless you are actually intending to clobber the preexisting $query object. Name your variables with this in mind. A good safeguard if you aren't sure what you may or may not be clobbering is to give your all your variables some unique prefix -- say, start them all out with "$myvar_" or whatever you like.
  16. Last updated: $Id$