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


PHP Templates::EvaluateDefault方法代碼示例

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


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

示例1: isset

    pla_error(_('You cannot perform updates while server is in read-only mode'));
}
if (!$ldapserver->haveAuthInfo()) {
    pla_error(_('Not enough information to login to server. Please check your configuration.'));
}
$new_dn = isset($_POST['new_dn']) ? $_POST['new_dn'] : null;
$required_attrs = isset($_POST['required_attrs']) ? $_POST['required_attrs'] : false;
$object_classes = unserialize(rawurldecode($_POST['object_classes']));
$redirect = isset($_POST['redirect']) ? $_POST['redirect'] : false;
# See if there are any presubmit values to work out.
if (isset($_POST['presubmit']) && count($_POST['presubmit']) && isset($_POST['template'])) {
    $templates = new Templates($ldapserver->server_id);
    $template = $templates->GetTemplate($_POST['template']);
    foreach ($_POST['presubmit'] as $attr) {
        $_POST['attrs'][] = $attr;
        $_POST['form'][$attr] = $templates->EvaluateDefault($ldapserver, $template['attribute'][$attr]['presubmit'], $_POST['container']);
        $_POST['vals'][] = $_POST['form'][$attr];
    }
    # @todo: This section needs to be cleaned up, and will be when the old templates are removed. In the mean time...
    # Rebuild the $_POST['attrs'] & $_POST['vals'], as they can be inconsistent.
    unset($_POST['attrs']);
    unset($_POST['vals']);
    foreach ($_POST['form'] as $attr => $val) {
        $_POST['attrs'][] = $attr;
        $_POST['vals'][] = $val;
    }
}
$vals = isset($_POST['vals']) ? $_POST['vals'] : array();
$attrs = isset($_POST['attrs']) ? $_POST['attrs'] : array();
# build the new entry
$new_entry = array();
開發者ID:azeckoski,項目名稱:az-php-sandbox,代碼行數:31,代碼來源:create.php

示例2: sprintf

     if (is_array($detail['value'])) {
         # If value is an array, then it must a select list.
         $type = 'select';
         $defaultresult = sprintf('<select name="form[%s]" id="%%s" %%s %%s>', $attr);
         foreach ($detail['value'] as $key => $value) {
             if (preg_match('/^_KEY:/', $key)) {
                 $key = preg_replace('/^_KEY:/', '', $key);
             } else {
                 $key = $value;
             }
             $defaultresult .= sprintf('<option name="%s" value="%s" %s>%s</option>', $value, $key, isset($detail['default']) && $detail['default'] == $key ? 'selected' : '', $value);
         }
         $defaultresult .= '</select>';
         $detail['value'] = $defaultresult;
     } else {
         $detail['value'] = $templates->EvaluateDefault($ldapserver, $detail['value'], $_REQUEST['container'], null, isset($detail['default']) ? $detail['default'] : null);
     }
     #if the default has a select list, then change the type to select
     if (preg_match('/<select .*>/i', $detail['value'])) {
         $type = 'select';
     }
 }
 # @todo: if value is a select list, then it cannot be hidden.
 # If this is a hidden attribute, then set its value.
 if (isset($detail['hidden']) && $detail['hidden']) {
     if (isset($detail['value'])) {
         printf('<input type="%s" name="form[%s]" id="%s" value="%s"/>', 'hidden', $attr, $attr, $detail['value']);
         continue;
     } else {
         pla_error(sprintf(_('Attribute [%s] is a HIDDEN attribute, however, it is missing a VALUE in your template.'), $attr));
     }
開發者ID:azeckoski,項目名稱:az-php-sandbox,代碼行數:31,代碼來源:template_engine.php


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