function i

Description

i() is our Universal Selector and the most useful function around. It lets you fetch, handle and display one or many items from your database:

// Fetch all socks
$socks = i('sock', all);
You can fetch an item by id, key or nickname
// Fetch a sock by id
$socks = i('sock', 123);
// Fetch a sock by key
$socks = i('sock', 'polkadot');
// Fetch a sock by nickname
$socks = i('sock_123');
The Universal Selector takes all the parameters of bunches:
// Fetch a set of socks
$socks = i('sock', array(
'title' => 'best-offer%',
'size' => array('XL', 'L'),
'codes' => array(2, 4),
'tag' => 1,
'order()' => 'color DESC, size ASC',
'limit()' => 10,
'instock' => true,
));
You can also fetch the current page:
// Fetch the current page
$page = i('page', current);
Or the current item in the script if you have a reader:
// Fetch the current read item
$page = i(item, current);

Arguments

table
  • name : table
  • type : string
  • descr : table
[params = null]
  • name : [params = null]
  • type : mixed
  • descr : parameter or array of parameters
[env = site]
  • name : [env = site]
  • type : string
  • descr : admin ou site

Return

mixed an item or a bunch

Find it

  • File : selector.php
  • Starts line : 55
  • Ends line : 92
  • (that's 37 lines of code)

Access

public