当前位置: 首页>>代码示例>>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;未经允许,请勿转载。