當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Application::render方法代碼示例

本文整理匯總了PHP中Silex\Application::render方法的典型用法代碼示例。如果您正苦於以下問題:PHP Application::render方法的具體用法?PHP Application::render怎麽用?PHP Application::render使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Silex\Application的用法示例。


在下文中一共展示了Application::render方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: indexAction

 public function indexAction(Application $app)
 {
     $files = $app['em']->getRepository('CMSilex\\Entities\\File')->findAll();
     $form = $app['form.factory']->createNamedBuilder(null);
     $form->add('file', FileType::class)->add('upload', SubmitType::class)->setAction($app->path('upload'));
     return $app->render('media/index.html.twig', ['form' => $form->getForm()->createView(), 'files' => $files, 'heading' => 'Media']);
 }
開發者ID:cmsilex,項目名稱:cmsilex,代碼行數:7,代碼來源:MediaController.php

示例2: authenticate

 /**
  * Authenticats the user 
  * @param 	Request Object - contains email and password
  *
  * @return Nothing
  */
 public function authenticate(Application $app, Request $request)
 {
     $email = $request->get('email');
     $password = $app->escape($request->get('password'));
     if ($email && $password) {
         $user = new User($app);
         $user_info = $user->find('user', array('email' => $email, 'password' => md5($password)));
         if ($user_info) {
             $app['session']->set('user', array('id' => $user_info[0]));
             return $app->redirect($request->getBaseUrl() . '/message/tweets');
         } else {
             return $app->render('index.php.twig', array('error_message' => "Invalid Credentials. Please try again!"));
         }
     } else {
         return $app->render('index.php.twig', array('error_message' => "Valid Email and password are required!"));
     }
 }
開發者ID:hupadhyayula,項目名稱:twitter,代碼行數:23,代碼來源:UserController.php

示例3: connect

 public function connect(Application $app)
 {
     $controllers = $app['controllers_factory'];
     $controllers->get('/', function (Application $app) {
         return $app->render('user_profile.twig');
     })->bind('user_profile');
     return $controllers;
 }
開發者ID:mjarschel,項目名稱:komenco,代碼行數:8,代碼來源:UserProfileControllerProvider.php

示例4: connect

 /**
  * @param Application $app
  * @return ControllerCollection
  */
 public function connect(Application $app)
 {
     /** @var ControllerCollection $controllers */
     $controllers = $app['controllers_factory'];
     $controllers->get('/', function (SupervisorApplication $app) {
         return $app->render('index.twig', ['supervisors' => $app->supervisor()->getInstances()]);
     })->bind('index');
     return $controllers;
 }
開發者ID:sanderkrause,項目名稱:supervisor-ui,代碼行數:13,代碼來源:IndexController.php

示例5: create

 public function create(Application $app, Request $request)
 {
     $message = $request->get('message');
     $user_id = intval($app['session']->get('user')['id']);
     if (strlen($message) <= 140) {
         $tweet = new Tweet($app);
         $tweet->save('tweets', array('tweet' => $message, 'user_id' => $user_id, 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")));
         $user_tweets = $tweet->find('tweets', array('user_id' => $user_id));
         echo var_dump($user_tweets);
     } else {
         $error_message = "Please limit the message to 140 charecters.";
     }
     return $app->render('tweets.php.twig', array('tweets' => $user_tweets, 'error_message' => $this->error_message));
 }
開發者ID:hupadhyayula,項目名稱:twitter,代碼行數:14,代碼來源:TweetController.php

示例6: connect

 /**
  * {@inheritdoc}
  */
 public function connect(Application $app)
 {
     $controllers = $app['controllers_factory'];
     $controllers->get('/', function (VBeeSiteApplication $app) {
         /** @var \VBee\Site\Application\Manager\PersonManagerInterface $personManager */
         $personManager = $app['vbee.manager.person'];
         $person = new Person();
         $person->setEmail('some@test.email');
         $person->setGivenName('some');
         $person->setFamilyName('test');
         $personManager->save($person);
         return $app->render('Homepage/index.html.twig', ['person' => $person]);
     });
     return $controllers;
 }
開發者ID:VincentBee,項目名稱:vbee_site,代碼行數:18,代碼來源:HomeControllerProvider.php

示例7: listEntityAction

 public function listEntityAction(CMSEntity $cmsEntity, Application $app, Request $request)
 {
     $pageNumber = $request->query->has('page') ? $request->query->get('page') : 1;
     $limit = $request->query->has('limit') ? $request->query->get('limit') : $cmsEntity->getDefaultPageLimit();
     $qb = $app['em']->getRepository($cmsEntity->getClass())->createQueryBuilder('e');
     if ($limit && $limit >= 0) {
         $qb->setMaxResults($limit);
         $qb->setFirstResult(($pageNumber - 1) * $limit);
     } else {
         $limit = null;
         $pageNumber = 1;
     }
     $paginator = new Paginator($qb);
     $entities = [];
     foreach ($paginator as $entity) {
         $entities[] = $entity;
     }
     $resultCount = count($paginator);
     $totalPages = $limit && $limit <= $resultCount ? ceil($resultCount / $limit) : 1;
     return $app->render('admin/list.html.twig', ['columns' => $cmsEntity->getColumns(), 'items' => $entities, 'cmsEntity' => $cmsEntity, 'heading' => ucwords($cmsEntity), 'resultCount' => $resultCount, 'currentPage' => $pageNumber, 'limit' => $limit, 'totalPages' => $totalPages]);
 }
開發者ID:cmsilex,項目名稱:cmsilex,代碼行數:21,代碼來源:CMSController.php

示例8: registerAction

 public function registerAction(Application $app, Request $request)
 {
     $builder = $app->form();
     $builder->add('email', EmailType::class)->add('password', RepeatedType::class, ['type' => PasswordType::class, 'first_options' => ['label' => 'Password'], 'second_options' => ['label' => 'Repeat Password']])->add('register', SubmitType::class);
     $form = $builder->getForm();
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         $userInfo = $form->getData();
         $newUser = new User();
         $password = $app->encodePassword($newUser, $userInfo['password']);
         $newUser->setUsername($userInfo['email']);
         $newUser->setPassword($password);
         $newUser->setEnabled(true);
         $newUser->setAccountNonExpired(true);
         $newUser->setAccountNonLocked(true);
         $newUser->setCredentialsNonExpired(true);
         $newUser->setRoles(['ROLE_USER']);
         $app['em']->persist($newUser);
         $app['em']->flush();
         return $app->redirect($app->url('login'));
     }
     return $app->render('authentication/register.html.twig', ['form' => $form->createView()]);
 }
開發者ID:cmsilex,項目名稱:cmsilex,代碼行數:23,代碼來源:AuthenticationController.php

示例9: todoWidgetAction

 function todoWidgetAction(Request $request, Application $app)
 {
     return $app->render('Erp/Dashboard/todo_widget.twig');
 }
開發者ID:ilanfreoua,項目名稱:pluginbaby,代碼行數:4,代碼來源:WidgetController.php

示例10: render

 /**
  * @see \Silex\Application\TwigTrait::render
  */
 public function render($view, array $parameters = [], Response $response = null)
 {
     return $this->app->render($view, $parameters, $response);
 }
開發者ID:sfblaauw,項目名稱:pulsar,代碼行數:7,代碼來源:AbstractController.php

示例11: indexAction

 public function indexAction(Application $app)
 {
     $response = $app->render('index.html.twig');
     return $response;
 }
開發者ID:benoitsmach,項目名稱:silex-bootstrap,代碼行數:5,代碼來源:FrontController.php

示例12: notificationShortcutWidgetAction

 function notificationShortcutWidgetAction(Request $request, Application $app)
 {
     return $app->render('Application/Widget/shortcut_notification.twig');
 }
開發者ID:ilanfreoua,項目名稱:pluginbaby,代碼行數:4,代碼來源:WidgetController.php

示例13: messagesAction

 public function messagesAction(Application $app)
 {
     $response = new Response();
     return $app->render('messages.twig', ['guestbook' => $app['guestbook']->get()], $response->setTtl(10));
 }
開發者ID:nix5longhorn,項目名稱:silex-guestbook,代碼行數:5,代碼來源:Index.php

示例14: home

 public function home(Application $app)
 {
     return $app->render('index.php.twig', array('error_message' => ''));
 }
開發者ID:hupadhyayula,項目名稱:twitter,代碼行數:4,代碼來源:GlobalController.php

示例15: listOptionsAction

 function listOptionsAction(Request $request, Application $app)
 {
     $options = $app['db']->fetchAll("SELECT * FROM application_options");
     return $app->render('Application/Administration/list_options.twig', ['options' => $options]);
 }
開發者ID:ilanfreoua,項目名稱:pluginbaby,代碼行數:5,代碼來源:AdministrationController.php


注:本文中的Silex\Application::render方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。