本文整理汇总了PHP中HomeController类的典型用法代码示例。如果您正苦于以下问题:PHP HomeController类的具体用法?PHP HomeController怎么用?PHP HomeController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HomeController类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
$url = isset($_GET['url']) ? $_GET['url'] : null;
$url = rtrim($url, '/');
$url = explode('/', $url);
if (empty($url[0])) {
require 'Controller/HomeController.php';
$controller = new HomeController();
$controller->index();
return false;
}
$file = 'Controller/' . ucfirst($url[0]) . 'Controller.php';
if (file_exists($file)) {
require $file;
} else {
throw new Exception("The file: {$file} Does not exists");
}
$controller_url = ucfirst($url[0]) . "Controller";
$controller = new $controller_url();
// Carregando o Modelo
$controller->loadModel($controller_url);
// Verificar se foi especificado um método (action)
if (isset($url[2])) {
// adicionar parametro no método
$controller->{$url[1]}($url[2]);
} else {
if (isset($url[1])) {
$controller->{$url[1]}();
} else {
$controller->index();
}
}
}
开发者ID:bigandhugemistake,项目名称:condesa,代码行数:33,代码来源:Core.php
示例2: logout
public function logout()
{
session_start();
session_unset();
$home = new HomeController();
return $home->index();
}
开发者ID:navi15486,项目名称:MusicMVC,代码行数:7,代码来源:loginController.php
示例3: save
function save()
{
include "config/site.php";
if ($commentswitch === "0") {
echo "-1";
return;
}
session_start();
if (strcasecmp($_POST['validationCode'], $_SESSION['validationCode']) != 0) {
echo "0";
return;
}
$this->reply = new Reply();
$this->reply->save();
include "config/site.php";
$model = new BaseModel();
//reconnect to the msyql
$fname = $tpl_root . "/static/" . $_POST['par_id'] . ".html";
ob_start();
$_GET["id"] = $_POST['par_id'];
$home = new HomeController();
$home->info();
$content = ob_get_contents();
ob_end_clean();
$fp = fopen($fname, "w");
fwrite($fp, $content);
fclose($fp);
echo "true";
}
开发者ID:puregamexyz,项目名称:bitdesign.github.io,代码行数:29,代码来源:ReplyController.php
示例4: fire
/**
* Execute the console command.
* Creates a HomeController and calls its cleanLeases function which terminates all expired leases.
*
* @return mixed
*/
public function fire()
{
$home_controller = new HomeController(new LaravelDuo\LaravelDuo());
$cleaner = $home_controller->cleanLeases();
if ($cleaner) {
$this->info($cleaner);
}
}
开发者ID:magnusboman,项目名称:concierge,代码行数:14,代码来源:leasemanager.php
示例5: showFellowSelect
public function showFellowSelect($city_id)
{
$fellowName = "Propel Fellow";
$home = new HomeController();
$year = $home->get_year();
$fellows = Group::where('name', '=', $fellowName)->first()->fellow()->distinct()->where('city_id', '=', $city_id)->where('year', '=', $year)->where('status', '=', '1')->where('user_type', '=', 'volunteer')->get();
//return $fellows;
return View::make('city.select-fellow')->with('fellows', $fellows);
}
开发者ID:makeadiff,项目名称:propel,代码行数:9,代码来源:CityChangeController.php
示例6: foundController
public function foundController()
{
if ($this->url == "home") {
$controller = new HomeController();
$controller->index();
} elseif ($this->url == "conversor") {
$controller = new ConversorController();
$controller->index();
}
}
开发者ID:NicolasMontoya,项目名称:portafolio,代码行数:10,代码来源:FrontController.php
示例7: GET
function GET($matches)
{
$home = new HomeController($matches);
if (array_key_exists(1, $matches)) {
if ($matches[1] == "json") {
$home->renderJson();
}
} else {
$home->render();
}
}
开发者ID:desurus,项目名称:tradesy-home-test,代码行数:11,代码来源:index.php
示例8: HomeAction
public static function HomeAction()
{
if (!isset($_SESSION["usuarioActual"])) {
HomeController::LoginAction();
return;
}
require_once './views/Home/index.php';
}
开发者ID:Rabp9,项目名称:sirall2,代码行数:8,代码来源:HomeController.php
示例9: perguntasSemelhantes
public function perguntasSemelhantes($texto)
{
$perguntas = DB::table('perguntas')->orderBy('data_hora', 'desc')->get();
$arRetorno = array();
foreach ($perguntas as $pergunta) {
if (HomeController::cosineSimilarity($texto, $pergunta->pergunta)) {
array_push($arRetorno, $pergunta);
}
}
return Response::json($arRetorno);
}
开发者ID:edgareler,项目名称:qsabe-remake,代码行数:11,代码来源:HomeController.php
示例10: __construct
/**
* "Start" the application:
* Analyze the URL elements and calls the according controller/method or the fallback
*/
public function __construct()
{
// create array with URL parts in $url
$this->splitUrl();
// check for controller: no controller given ? then load start-page
if (!$this->url_controller) {
require APP . 'controller/home.php';
$page = new HomeController();
$page->index();
} elseif (file_exists(APP . 'controller/' . $this->url_controller . '.php')) {
// here we did check for controller: does such a controller exist ?
// if so, then load this file and create this controller
// example: if controller would be "car", then this line would translate into: $this->car = new car();
require APP . 'controller/' . $this->url_controller . '.php';
$controller = ucfirst($this->url_controller) . 'Controller';
$this->url_controller = new $controller();
// check for method: does such a method exist in the controller ?
if (method_exists($this->url_controller, $this->url_action)) {
if (!empty($this->url_params)) {
// Call the method and pass arguments to it
call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
} else {
// If no parameters are given, just call the method without parameters, like $this->home->method();
$this->url_controller->{$this->url_action}();
}
} else {
if (strlen($this->url_action) == 0) {
// no action defined: call the default index() method of a selected controller
$this->url_controller->index();
} else {
header('location: ' . URL . 'error');
}
}
} else {
header('location: ' . URL . 'error');
}
}
开发者ID:Technology-Across-the-Curriculum,项目名称:WordSalad-Service,代码行数:41,代码来源:application.php
示例11: runModule
private function runModule()
{
switch ($this->sModule) {
case "Home":
$oController = new HomeController();
$oController->run($this->sAction, $this->asArgs, $this->sView);
break;
case "ShowRoom":
$oController = new ShowRoomController();
$oController->run($this->sAction, $this->asArgs, $this->sView);
break;
case "Basic":
$oController = new BasicController();
$oController->run($this->sAction, $this->asArgs, $this->sView);
break;
case "Products":
$oController = new ProdutosController();
$oController->run($this->sAction, $this->asArgs, $this->sView);
break;
default:
echo "Erro: Módulo não existe";
}
/* switch ( $this->sModule ) */
}
开发者ID:evandrolacerda,项目名称:PHP_8860,代码行数:24,代码来源:classMasterController.php
示例12: getPage
public function getPage($type, $slug = '')
{
$type_post = Type::where('type', $type)->first();
$posts_child = $galleries = $posts = $row = array();
if (empty($type_post)) {
return Response::view('errors.not-found')->header('Content-Type', '404 Not Found');
}
if ($type_post->template == 'gallery') {
$row = Post::where('slug', $type)->first();
$type_post = Type::where('id', $row->type_id)->first();
$galleries = Gallery::where('post_id', $row->id)->get();
} else {
if ($type_post->template == 'news') {
if ($slug == '') {
$posts = Post::where('type_id', $type_post->id)->where('status', 1)->where('parent', 0)->orderBy('created_at', 'desc')->paginate(6);
} else {
$row = Post::where('slug', $slug)->first();
}
foreach ($posts as $key => $post) {
$preview = HomeController::previewFirstSimbol($post->text, 500);
$post->preview = $preview['text'];
}
} else {
if ($type_post->template == 'portfolio') {
$posts = Post::where('type_id', $type_post->id)->where('status', 1)->where('parent', 0)->orderBy('order', 'asc')->get();
foreach ($posts as $key => $post) {
$post->galleries = Gallery::where('post_id', $post->id)->get();
}
} else {
$posts = Post::where('type_id', $type_post->id)->where('status', 1)->where('parent', 0)->orderBy('order', 'asc')->get();
$posts_child = Post::where('type_id', $type_post->id)->where('status', 1)->where('parent', '!=', 0)->orderBy('order', 'asc')->get();
if ($slug != '') {
$row = Post::where('slug', $slug)->first();
if ($row->parent != 0) {
$parent = Post::where('id', $row->parent)->first();
$row->parent_title = $parent->name;
$row->parent_slug = $parent->slug;
}
$galleries = Gallery::where('post_id', $row->id)->get();
}
}
}
}
$view = array('type' => $type_post, 'posts' => $posts, 'posts_child' => $posts_child, 'row' => $row, 'galleries' => $galleries);
return View::make('home.' . $type_post->template, $view);
}
开发者ID:ldin,项目名称:portfolio,代码行数:46,代码来源:HomeController.php
示例13: contact
/**
* Envoie un mail de contact
**/
public function contact()
{
if ($this->request->is('post')) {
HomeController::loadModel('Contact');
if (!empty($this->request->data['Contact']['website'])) {
$this->Session->setFlash('Merci pour votre message', 'flash');
$this->request->data = array();
} else {
if ($this->Contact->sendMail($this->request->data['Contact'])) {
$this->Session->setFlash('Merci pour votre message', 'flash');
$this->request->data = array();
} else {
$this->Session->setFlash('Oups, quelque chose s\'est mal passé', 'flash', array('class' => 'danger'));
}
}
}
}
开发者ID:Elhebert,项目名称:city-bar,代码行数:20,代码来源:HomeController.php
示例14: pageCode
public function pageCode()
{
$html = '';
$model = FrontData::getInstance();
$home = HomeController::getInstance();
$pache = $GLOBALS['pache'];
$page = $home->page;
if (isset($home->tag)) {
$listingType = 'tag';
$listingTypeValue = $home->tag;
} else {
if (isset($home->categories)) {
$listingType = 'categories';
$listingTypeValue = $home->categories;
} else {
$listingType = '';
$listingTypeValue = NULL;
}
}
$countPage = ceil($model->articleCount($listingType, $listingTypeValue) / $pache->pagelimit);
$i = $page;
if ($i - 4 < 1) {
$i = 5;
}
for ($i = $i - 4; $i < $page + 5; ++$i) {
if ($i > $countPage) {
break;
}
$url = '?';
if (isset($_GET[$listingType])) {
$url .= $listingType . '=' . urlencode($_GET[$listingType]) . '&';
}
if ($page == $i) {
$html .= '<a class="pagecode current"><div class="code">' . $i . '</div><div class="bg"></div></a>';
} else {
$html .= '<a class="pagecode" href="' . $url . 'page=' . $i . '">' . $i . '</a> ';
}
}
$form = '<form method="get" style="display:none;"><input name="page" size="4" /></form>';
$html = '<div id="page">' . $html . $form . '</div>';
return $html;
}
开发者ID:VecHK,项目名称:pache,代码行数:42,代码来源:HomeComponent.class.php
示例15: _initialize
public function _initialize()
{
parent::_initialize();
$this->assign('check_all', false);
$this->assign('search_url', U('lists'));
define('ADDON_PUBLIC_PATH', '');
defined('_ADDONS') or define('_ADDONS', MODULE_NAME);
defined('_CONTROLLER') or define('_CONTROLLER', CONTROLLER_NAME);
defined('_ACTION') or define('_ACTION', ACTION_NAME);
$this->model = M('model')->getByName('public');
$this->assign('model', $this->model);
// dump ( $this->model );
$res['title'] = $this->model['title'];
$res['url'] = U('lists');
$res['class'] = ACTION_NAME != 'help' ? 'current' : '';
$nav[] = $res;
// $res ['title'] = '管理员配置';
// $res ['url'] = U ( 'Home/Admin/lists' );
// $res ['class'] = '';
// $nav [] = $res;
if (ACTION_NAME == 'help') {
$res['title'] = '接口配置帮助';
$res['url'] = U('help', array('public_id' => $_GET['public_id']));
$res['class'] = 'current';
$nav[] = $res;
}
$this->assign('nav', $nav);
}
开发者ID:chenpusn,项目名称:guoxian,代码行数:28,代码来源:PublicController.class.php
示例16: getInstance
public static function getInstance($params = array())
{
if (!self::$instance instanceof self) {
self::$instance = new self($params);
}
return self::$instance;
}
开发者ID:VecHK,项目名称:pache,代码行数:7,代码来源:index.php
示例17: display
/**
* 模板显示 调用内置的模板引擎显示方法,
* @access protected
* @param string $templateFile 指定要调用的模板文件
* @return void
*/
protected function display($template)
{
$file = T('Addons://' . parse_name($_GET['_addons'], 1) . '@./' . ucfirst($_GET['_controller']) . '/' . $_GET['_action']);
define('IS_ADDON', true);
parent::display($file);
// 重要:要避免陷入$this->display()循环
}
开发者ID:applemin,项目名称:tangguo,代码行数:13,代码来源:AddonController.class.php
示例18:
function __construct()
{
parent::__construct();
$this->uid = is_login();
if (!$this->uid) {
$this->redirect('User/login');
}
}
开发者ID:rainly123,项目名称:zyzm,代码行数:8,代码来源:ManageController.class.php
示例19: _initialize
public function _initialize()
{
parent::_initialize();
$this->Notice = M('notice');
$this->Ndetail = M('noticeDetail');
$this->Youpin = M('youpin');
$this->Ydetail = M('youpinDetail');
}
开发者ID:xiaolw,项目名称:wacms,代码行数:8,代码来源:MusicController.class.php
示例20:
function __construct()
{
parent::__construct();
$this->load->library('session');
$this->load->model('user_model', 'users');
if ($this->session->userdata('admin') or $this->session->userdata('user')) {
$this->authen = true;
}
}
开发者ID:asonweb,项目名称:mycicms,代码行数:9,代码来源:user.php
注:本文中的HomeController类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论