本文整理匯總了PHP中ViewManager::setVariable方法的典型用法代碼示例。如果您正苦於以下問題:PHP ViewManager::setVariable方法的具體用法?PHP ViewManager::setVariable怎麽用?PHP ViewManager::setVariable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ViewManager
的用法示例。
在下文中一共展示了ViewManager::setVariable方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct()
{
$this->view = ViewManager::getInstance();
// get the current user and put it to the view
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
if (isset($_SESSION["currentuser"])) {
$this->currentUser = new User(NULL, $_SESSION["currentuser"]);
//add current user to the view, since some views require it
$usermapper = new UserMapper();
$this->tipo = $usermapper->buscarPorLogin($_SESSION["currentuser"]);
/* print_r($this->tipo);
die();*/
$this->view->setVariable("tipo", $this->tipo);
$this->view->setVariable("currentusername", $this->currentUser->getLogin());
}
if (isset($_SESSION["currentcod1"]) && isset($_SESSION["currentcod2"]) && isset($_SESSION["currentcod3"])) {
$codigomapper1 = new CodigoMapper();
$this->currentCod1 = $codigomapper1->buscarPinchoPorCodigo($_SESSION["currentcod1"]);
$codigomapper2 = new CodigoMapper();
$this->currentCod2 = $codigomapper2->buscarPinchoPorCodigo($_SESSION["currentcod2"]);
$codigomapper3 = new CodigoMapper();
$this->currentCod3 = $codigomapper3->buscarPinchoPorCodigo($_SESSION["currentcod3"]);
}
}
示例2: __construct
public function __construct()
{
$this->view = ViewManager::getInstance();
// get the current user and put it to the view
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
if (isset($_SESSION["currentuser"])) {
$this->currentUser = new User($_SESSION["currentuser"]);
//add current user to the view, since some views require it
$this->view->setVariable("currentusername", $this->currentUser->getUsername());
}
}
示例3: __construct
public function __construct()
{
$this->view = ViewManager::getInstance();
// get the current user and put it to the view
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
//inicializa la variable
$this->friendDAO = new FriendDAO();
if (isset($_SESSION["currentuser"])) {
//En la sesion de currentuser se encuentra todo el usuario
//ya que al hacer el login se introdujo todo el usuario en la sesion
$this->currentUser = $_SESSION["currentuser"];
$this->view->setVariable("currentusername", $this->currentUser);
//consigue el numero total de solicitudes de amistad
$numSolicitudes = $this->friendDAO->getNumSolicitudes($this->currentUser->getEmail());
//Carga el num solicitudes en la vista
$this->view->setVariable("numSolicitudes", $numSolicitudes);
}
}