PHP Classes
Icontem

File: example.custom_modes.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Joshua Townsend  >  Request Data  >  example.custom_modes.php  
File: example.custom_modes.php
Role: Example script
Content type: text/plain
Description: Example of using custom modes to point to your own data
Class: Request Data
Retrieve and process request parameters
 

Contents

Class file image Download
<?php
// Using custom modes
require "request.class.php";

$request = new request();

$request->add_mode("x"$_SESSION); // Add session as the mode "x".  Note that "s" is already taken by $_SERVER
$time $request->get_int("logged_time""x"); // Example of getting data from $_SESSION using same syntax as other variables
$request->remove_mode("x"); // mode "x" no longer needed

// You could also do this:
$request->allow_mode_override(true);
$request->add_mode("s"$_SESSION);
$time $request->get_int("logged_time""s");
$request->remove_mode("s");

$exampledata = array("id" => "5""username" => "jsmith"); // Example data, such as that about a user

$request->add_mode("u"$exampledata); // Add user data as the mode "u"
$id $request->get_int("id""u"); // Example of getting data from $exampledata using same syntax as other variables

$request->set_default_mode("u");
$id $request->get_int("id"); // Now "id" comes from mode "u", because second parameter was equivalent to null
?>

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products