当前位置: 首页>>代码示例>>PHP>>正文


PHP JView::assign方法代码示例

本文整理汇总了PHP中JView::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP JView::assign方法的具体用法?PHP JView::assign怎么用?PHP JView::assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JView的用法示例。


在下文中一共展示了JView::assign方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: prepareAjaxResponse

 /**
  * Prepare an xml file content holding
  * a standard record for returning result
  * of an ajax request
  *
  * @param JView $view the view handling the request
  */
 public static function prepareAjaxResponse($view)
 {
     // use Joomla wml object
     jimport('joomla.utilities.simplexml');
     // create a root node
     $xml = new JSimpleXMLElement('item', array('id' => 'shajax-response'));
     // add children : status, message, message code, task
     $status =& $xml->addChild('status');
     $message =& $xml->addChild('message');
     $messagecode =& $xml->addChild('messagecode');
     $taskexecuted =& $xml->addChild('taskexecuted');
     // set default values
     $status->setData('_');
     $message->setData('_');
     $messagecode->setData('_');
     $taskexecuted->setData('_');
     // set their respective values
     $vErrors = $view->getErrors();
     if (empty($vErrors)) {
         // retrieve messagecode and task
         if (empty($view->messagecode)) {
             $view->assign('messagecode', 'COM_SH404SEF_OPERATION_COMPLETED');
         }
         if (empty($view->taskexecuted)) {
             $view->assign('taskexecuted', '');
         }
         // either a success or a redirect
         if (empty($view->redirectTo)) {
             // no error
             $status->setData('success');
             $msg = empty($view->message) ? JText16::_('COM_SH404SEF_OPERATION_COMPLETED') : $view->message;
             $message->setData('<ul>' . $msg . '</ul>');
             $messagecode->setData($view->messagecode);
         } else {
             $status->setData('redirect');
             $glue = strpos($view->redirectTo, '?') === false ? '?' : '&';
             $message->setData($view->redirectTo . $glue . 'sh404sefMsg=' . $view->messagecode);
         }
         $taskexecuted->setData($view->taskexecuted);
     } else {
         $status->setData('failure');
         $messageTxt = '';
         foreach ($vErrors as $error) {
             $messageTxt .= '<li>' . $error . '</li>';
         }
         $message->setData('<ul>' . $messageTxt . '</ul>');
     }
     // output resulting text, no need for a layout file I think
     $output = '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
     $output .= $xml->toString();
     return $output;
 }
开发者ID:sangkasi,项目名称:joomla,代码行数:59,代码来源:general.php

示例2: loadBrowser

 /**
  * Load Browser view
  */
 function loadBrowser()
 {
     jimport('joomla.application.component.view');
     $browser = new JView($config = array('base_path' => JCE_LIBRARIES, 'layout' => 'browser'));
     $browser->assign('action', $this->getFormAction());
     $browser->display();
 }
开发者ID:rubencamargogomez,项目名称:custom_properties,代码行数:10,代码来源:manager.php

示例3: onElasticSearchDisplay

 /**
  * Method called to display elements of ElasticSearch result
  * The view must be in the file elasticsearch/plg_name/view/type_name/default.php
  * 
  * @param Array $data
  * 
  * @return string html display of the element
  * */
 public function onElasticSearchDisplay($type, $data)
 {
     // Check the type
     if ($type != $this->type) {
         return false;
     }
     $highlight = $this->smartHighLight($data);
     $path = JPATH_SITE . '/plugins/elasticsearch/' . $type;
     $view = new JView(array('name' => 'plg_' . $type, 'base_path' => $path));
     // Pass data to the view
     $view->assign('data', $data->getData());
     $view->assign('highlight', $highlight);
     // Pass type to the view
     $view->assign('type', $type);
     return $view->loadTemplate();
 }
开发者ID:joomlacorner,项目名称:jes,代码行数:24,代码来源:adapter.php


注:本文中的JView::assign方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。