s::set PHP Method

set() static public method

Sets a session value by key
static public set ( mixed $key, mixed $value = false )
$key mixed The key to define
$value mixed The value for the passed key
    static function set($key, $value = false)
    {
        if (!isset($_SESSION)) {
            return false;
        }
        if (is_array($key)) {
            $_SESSION = array_merge($_SESSION, $key);
        } else {
            $_SESSION[$key] = $value;
        }
    }

Usage Example

示例#1
0
 public function paginated($mode = 'sidebar')
 {
     if ($limit = $this->page->blueprint()->pages()->limit()) {
         $hash = sha1($this->page->id());
         switch ($mode) {
             case 'sidebar':
                 $id = 'pages.' . $hash;
                 $var = 'page';
                 break;
             case 'subpages/visible':
                 $id = 'subpages.visible.' . $hash;
                 $var = 'visible';
                 break;
             case 'subpages/invisible':
                 $id = 'subpages.invisible.' . $hash;
                 $var = 'invisible';
                 break;
         }
         $children = $this->paginate($limit, array('page' => get($var, s::get($id)), 'omitFirstPage' => false, 'variable' => $var, 'method' => 'query'));
         // store the last page
         s::set($id, $children->pagination()->page());
         return $children;
     } else {
         return $this;
     }
 }
All Usage Examples Of s::set