本文整理汇总了PHP中View::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP View::exists方法的具体用法?PHP View::exists怎么用?PHP View::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View
的用法示例。
在下文中一共展示了View::exists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: page
public function page($page = FALSE)
{
if ($locale = Cookie::get('locale')) {
App::setLocale($locale);
}
if (!$page) {
return Redirect::to(Lang::get('navigation.consumer'), 301);
}
$nav = array();
foreach (['consumer', 'exporter'] as $item) {
$loc = Lang::get('navigation.' . $item);
$link = strtolower(str_replace(' ', '-', $loc));
if ($link == $page) {
$page = $item;
}
$nav[$link] = ucfirst($loc);
}
if (!View::exists('layouts.public.' . $page)) {
App::abort(404);
}
$sub_nav = array();
$view = View::make('layouts.public.' . $page);
switch ($page) {
case 'exporter':
$sub_nav = ['assortment', 'horticulture', 'certification', 'contact'];
$picturebox = new Picturebox\PictureboxManager();
$view->with('picturebox', $picturebox);
break;
}
$view->with('sub_nav', $sub_nav);
return $view->with('nav', $nav);
}
示例2: action_index
public function action_index($modelName)
{
$model = $this->getClassObject($modelName);
$columnModel = $model::first();
Input::flash();
if (Input::get($modelName) != null && $this->addConditions($model, $modelName)->first() != null) {
$columnModel = $this->addConditions($model, $modelName)->first();
}
if ($columnModel == null) {
return Redirect::to("/lara_admin/models/{$modelName}/new");
}
$columns = $columnModel->columns();
$sort_options = $this->setOrderOptions($columns);
$models = $this->addConditions($model, $modelName)->order_by($sort_options["column_order"], $sort_options["sort_direction"])->paginate($model->perPage);
$request_uri = Request::server("REQUEST_URI");
$request_uri = preg_replace("/&order=[^&]*/", "", $request_uri);
if (!preg_match("/\\?/i", Request::server("REQUEST_URI"))) {
$request_uri .= "?";
}
//TODO function getCustomAction
$name_custom_action = "lara_admin::" . Str::plural(Str::lower($modelName)) . "." . preg_replace("/action_/", "", __FUNCTION__);
if (View::exists($name_custom_action) != false) {
$view = View::make($name_custom_action, array("sort_options" => $sort_options, "request_uri" => $request_uri, "modelName" => $modelName, "modelInstance" => $model, "models" => $models, "columns" => $columns));
} else {
$view = View::make("lara_admin::models.index", array("sort_options" => $sort_options, "request_uri" => $request_uri, "modelName" => $modelName, "modelInstance" => $model, "models" => $models, "columns" => $columns));
}
$this->defaultAttrForLayout($modelName, $view);
return $this->response_with(array("xml", "json", "csv"), $this->collectionToArray($models->results), true);
}
示例3: view
/**
* Makes view
*
* @param string $viewName
* @param array $data
* @param string $controller
*
* @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory
*/
public function view($viewName, array $data = [], $controller = "")
{
foreach ($this->beforeRender as $method) {
$this->{$method}($viewName, $data, $controller);
}
\View::share("__siteTitle", $this->title);
\View::share("__siteDescription", $this->description);
\View::share("__siteKeywords", $this->keywords);
\View::share("__bodyId", $this->bodyId);
\View::share("__bodyClass", $this->bodyClass);
\View::share("__styles", $this->styles);
\View::share("__scripts", $this->scripts);
$rc = new \ReflectionClass($this);
$className = str_replace(\App::getNamespace() . "Http\\Controllers\\", "", $rc->getName());
\View::share("__controller", $controller ? $controller : "{$className}::{$viewName}");
if ($this->viewPrefix) {
$nbView = $this->viewPrefix . '.' . $viewName;
} else {
$nbView = 'controllers.' . str_replace("\\", ".", $className) . '.' . $viewName;
}
if (\View::exists($nbView)) {
$viewName = $nbView;
}
if (!empty($this->formData)) {
if ($this->oldInputHasPriority) {
$this->request()->session()->flashInput(array_merge($this->formData, $this->request()->old(null, [])));
} else {
$this->request()->session()->flashInput($this->request()->old(null, []), $this->formData);
}
}
return view($viewName, $this->viewData, $data);
}
示例4: show
/**
* Display the specified resource.
*
* @param int $id
*/
public function show($id)
{
// if exist external content then send it to browser, increment views
$external_content = $this->showPage->checkAndGetContentFromHtmlFile(app('veer')->siteId, $id);
if (!empty($external_content)) {
\Veer\Models\Page::where('id', '=', $id)->increment('views');
return \Response::make($external_content, 200)->header('Content-type', 'text/html');
}
$page = $this->showPage->getPage($id, app('veer')->siteId);
if (!is_object($page)) {
return Redirect::route('page.index');
}
$page->increment('views');
$page->load(array('images' => function ($q) {
return $q->orderBy('pivot_id', 'asc');
}, 'tags', 'attributes', 'downloads', 'userlists', 'user'));
$page->imagesIds = collect($page->images->getDictionary());
if ($page->show_comments == 1) {
$this->showPage->loadComments($page, 'page');
}
$paginator_and_sorting = get_paginator_and_sorting();
$data = array("page" => $page, "subpages" => $this->showPage->withChildPages(app('veer')->siteId, $page->id, $paginator_and_sorting), "parentpages" => $this->showPage->withParentPages(app('veer')->siteId, $page->id, $paginator_and_sorting), "products" => $this->showPage->withProducts(app('veer')->siteId, $page->id, $paginator_and_sorting), "categories" => $this->showPage->withCategories(app('veer')->siteId, $page->id), "template" => $this->template);
$blade_path = $this->template . '.pages.' . $id;
$viewLink = $this->template . '.page';
// page with special design
if ($page->original == 1 && \View::exists($blade_path)) {
$viewLink = $blade_path;
}
$view = viewx($viewLink, $data);
$this->view = $view;
return $view;
}
示例5: returnShortCodes
public static function returnShortCodes()
{
$tpl = static::returnTpl();
shortcode::add("gallery", function ($params = null) use($tpl) {
$default = array('tpl' => "gallery-default");
$params = array_merge($default, (array) $params);
if (empty($params['tpl']) || !View::exists($tpl . $params['tpl'])) {
throw new Exception('Template not found: ' . $tpl . $params['tpl']);
}
if (!isset($params['id'])) {
#return false;
#return "Error: id of gallery is not defined!";
throw new Exception('ID of gallery is not defined');
}
$gallery_id = $params['id'];
$gallery = Gallery::where('id', $gallery_id)->first();
if (!is_object($gallery) || !@$gallery->id) {
return false;
#return "Error: gallery #{$gallery_id} doesn't exist!";
}
$photos = $gallery->photos;
if (!$photos->count()) {
return false;
}
#dd($tpl.$params['tpl']);
#dd(compact($photos));
#return View::make($tpl.$params['tpl'], compact($photos)); ## don't work
return View::make($tpl . $params['tpl'], array('photos' => $photos));
});
}
示例6: getTemplates
public function getTemplates($slug)
{
$view_slug = 'rtclientmanager::angular-templates.' . $slug;
if (\View::exists($view_slug)) {
return view($view_slug);
}
abort(404);
}
示例7: view
public function view($view)
{
$currentView = 'admin-lte::default.' . $view;
if (\View::exists($currentView)) {
return $currentView;
}
abort(404);
}
示例8: showTemplate
/**
* Display a listing of emailtemplates
*
* @return Response
*/
public function showTemplate($template)
{
// return $template;
if (View::exists('emails.templates.' . $template)) {
return View::make('emails.templates.' . $template);
}
return "Template does not exist";
}
示例9: View
function __call($name, $arguments)
{
$view = new View('page/' . strtolower($name));
if (!$view->exists()) {
$view = new View('error/404');
}
$this->view->content = $view;
}
示例10: getPage
public function getPage($page)
{
if (View::exists('documentation.' . $page)) {
View::share('page', $page);
$this->layout->content = View::make('documentation.' . $page);
} else {
return App::abort(404);
}
}
示例11: showPage
public function showPage($page)
{
$data['page'] = ucfirst($page);
if (View::exists('pages/' . $page)) {
return View::make('pages/' . $page, $data);
} else {
return App::abort(404);
}
}
示例12: view
/**
* Load a theme view from themes/{theme name}
* Folder /themes instead /views loaded on boot from SiteServiceProvider
*
* @return string
*/
public function view($name, array $data = array())
{
$view_name = 'site::' . THEME . '.' . $name;
// Set to 'default' view if view not found
if (!\View::exists($view_name)) {
$view_name_arr = explode('.', $view_name);
$view_name = str_replace(end($view_name_arr), 'default', $view_name);
}
return \View::make($view_name, $data);
}
示例13: makeRowPath
private function makeRowPath($view = null)
{
if (!$view) {
$view = 'default';
}
$path = $this->makeViewPath('rows', $view);
if (!\View::exists($path)) {
throw new \Mrself\YaF\Exceptions\FormException(['name' => $view], 2);
}
return $path;
}
示例14: index
public function index($slug)
{
$object = $this->object->join('post_translations as t', 't.post_id', '=', 'posts.id')->select('id', 'slug', 'title', 'content', 'meta_desc')->active()->whereSlug($slug)->first();
if (!$object) {
App::abort(404);
}
$meta = ['title' => $object->title, 'desc' => $object->meta_desc];
if (\View::exists('berrier::themes.' . config('berrier.theme.name') . '.custom.' . $slug)) {
return view('berrier::themes.' . config('berrier.theme.name') . '.custom.' . $slug)->with(compact('object'))->with(compact('meta'));
}
return view('berrier::themes.' . config('berrier.theme.name') . '.post')->with(compact('object'))->with(compact('meta'));
}
示例15: index
public function index($slug)
{
$post = $this->post->select('id', 'slug', 'title', 'content', 'meta_desc', 'media', 'categories')->active()->whereSlug($slug)->first();
if (!$post) {
App::abort(404);
}
$meta = ['title' => $post->title, 'desc' => $post->meta_desc];
if (\View::exists('berrier::themes.' . config('berrier.theme.name') . '.custom.' . $slug)) {
return view('berrier::themes.' . config('berrier.theme.name') . '.custom.' . $slug)->with(compact('page'))->with(compact('meta'));
}
return view('berrier::themes.' . config('berrier.theme.name') . '.post')->with(compact('post'))->with(compact('meta'));
}