本文整理汇总了PHP中tpl::find方法的典型用法代码示例。如果您正苦于以下问题:PHP tpl::find方法的具体用法?PHP tpl::find怎么用?PHP tpl::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tpl
的用法示例。
在下文中一共展示了tpl::find方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderItem
public static function renderItem($message, $form_id, $type = 'error')
{
if (!$message) {
return '';
}
if (is_array($message)) {
foreach ($message as $key => &$item) {
$item = self::renderItem($item, $form_id, $type);
}
return $message;
} else {
$html = FALSE;
if ($message && ($options = id::decode($form_id))) {
$template = new tpl(tpl::find($type . '-message', $options), array('message' => $message));
$html = $template->render();
}
return $html;
}
}
示例2: renderFields
public static function renderFields($fields)
{
spl_autoload_register(array('field', 'autoloader_field'), FALSE, TRUE);
$data = $options = $data['fields'] = $sort_order = array();
foreach ($fields as $key => $value) {
$sort_order[$key] = $value['weight'];
}
array_multisort($sort_order, SORT_ASC, $fields);
foreach ($fields as $field_id => $field_info) {
if (!$field_info['status']) {
continue;
}
$action = self::getAction($field_info['type']['type']);
if (!empty($action['class'])) {
$data['fields'][] = $action['class']::getInstance($field_info)->render();
}
}
$last_form_id = oc::registry()->config->get('quick_order_pro_last_form_id');
if (!empty($last_form_id)) {
$options = id::decode($last_form_id);
$data += $options;
}
return tpl::getInstance(tpl::find('fields', $options), $data)->render();
}
示例3: index
//.........这里部分代码省略.........
$this->session->data['quick_order_pro_success'][$this->form_id] = $template_info['success_message'];
}
$this->redirect($redirect);
}
$this->data['total'] = false;
$this->data['fields'] = field::renderFields($template_info['fields']);
if ($this->data['type'] == '1') {
// product
if ($product_info['quantity'] <= 0 && !$template_info['stock_checkout']) {
return;
}
$this->data['product_info'] = array('name' => $product_info['name'], 'option' => array(), 'quantity' => $product_info['minimum']);
if ($template_info['use_option'] && $template_info['show_option']) {
foreach ($this->model_catalog_product->getProductOptions($this->request->get['product_id']) as $option) {
if (in_array($option['type'], array('text', 'textarea', 'date', 'datetime', 'time')) && !empty($option['option_value'])) {
$this->data['product_info']['option'][] = array('name' => $option['name'], 'value' => utf8_strlen($option['option_value']) > 20 ? utf8_substr($option['option_value'], 0, 20) . '..' : $option['option_value']);
}
}
}
if ($template_info['show_total']) {
if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) {
$total = $product_info['price'];
}
if ((double) $product_info['special']) {
$total = $product_info['special'];
}
$quantity = $product_info['minimum'];
if ($total && $quantity) {
$this->data['total'] = $this->currency->format($this->calculateTax($total, $quantity, $product_info['tax_class_id']));
}
}
} else {
if ($template_info['show_total']) {
// Totals
$this->load->model('setting/extension');
$total_data = array();
$total = 0;
$taxes = $this->cart->getTaxes();
// Display prices
if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) {
$sort_order = array();
$results = $this->model_setting_extension->getExtensions('total');
foreach ($results as $key => $value) {
$sort_order[$key] = $this->config->get($value['code'] . '_sort_order');
}
array_multisort($sort_order, SORT_ASC, $results);
foreach ($results as $result) {
if ($this->config->get($result['code'] . '_status')) {
$this->load->model('total/' . $result['code']);
$this->{'model_total_' . $result['code']}->getTotal($total_data, $total, $taxes);
}
}
}
$this->data['total'] = $this->currency->format($total);
}
}
$this->document->addScript('catalog/view/javascript/quick_order_pro/quick_order_pro.js');
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/stylesheet/quick_order_pro.css')) {
$this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/quick_order_pro.css');
} else {
$this->document->addStyle('catalog/view/theme/default/stylesheet/quick_order_pro.css');
}
$language_id = $this->config->get('config_language_id');
$this->data['text_process'] = $this->language->get('text_process');
$this->data['text_required'] = $this->language->get('text_required');
$this->data['text_total'] = $this->language->get('text_total');
if (!empty($template_info['button'][$language_id])) {
$this->data['button_send'] = $template_info['button'][$language_id];
} else {
$this->data['button_send'] = $this->language->get('button_send');
}
if (array_key_exists($language_id, $template_info['title']) && $this->_stripText($template_info['title'][$language_id]) != '') {
$this->data['heading_title'] = $template_info['title'][$language_id];
} else {
$this->data['heading_title'] = FALSE;
}
if (array_key_exists($language_id, $template_info['description']) && $this->_stripText($template_info['description'][$language_id]) != '') {
$this->data['description'] = html_entity_decode($template_info['description'][$language_id], ENT_QUOTES, 'UTF-8');
} else {
$this->data['description'] = FALSE;
}
$class = $position;
if ($this->_stripText($template_info['class']) != '') {
$class .= ' ' . $this->_stripText($template_info['class']);
}
$this->data['class'] = $class;
$this->data['template_info'] = $template_info;
$this->data['item_id'] = self::$item_id;
if (!empty(oc::registry()->message->data['error'])) {
if (array_key_exists('fields', oc::registry()->message->data['error'])) {
unset(oc::registry()->message->data['error']['fields']);
}
$this->data['error'] = oc::registry()->message->data['error'];
} else {
$this->data['error'] = NULL;
}
$this->data['success'] = message::getState('success', $this->form_id, 'success');
$this->template = tpl::find($position, id::decode($this->form_id));
$this->render();
}