本文整理汇总了PHP中FormElement::input方法的典型用法代码示例。如果您正苦于以下问题:PHP FormElement::input方法的具体用法?PHP FormElement::input怎么用?PHP FormElement::input使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormElement
的用法示例。
在下文中一共展示了FormElement::input方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAttributes
public function getAttributes($sub_cat_id = 1, $status = "include", $limit = 10, $order = "ORDER BY count DESC, type ASC, name DESC ")
{
$lang = "eng";
$attribute_name = "name";
if (isset($_SESSION["lang"])) {
$lang = $_SESSION["lang"];
if ($lang == "nor") {
$attribute_name = "name_nor";
}
}
$type_query = "";
if ($status == "exclude-checkboxes") {
$type_query = ' AND type != "checkbox" AND type != "radio" ';
}
if ($status == "only-checkboxes") {
$type_query = ' AND (type = "checkbox" OR type = "radio")';
}
$database = new Database();
$database->query('SELECT * FROM attributes WHERE sub_cat_id=:sub_cat_id ' . $type_query . $order);
$database->bind(':sub_cat_id', $sub_cat_id);
$attributes = $database->fetchAll();
$i = 0;
if ($attributes) {
foreach ($attributes as $attribute) {
$i++;
$hidden = $i > $limit ? " hide-input-element" : "";
$type = $attribute["type"];
$list = array();
$smart = $type == "text" ? " smart-search" : "";
if ($type == "checkbox" or $type == "radio") {
$list = self::getAtributeValues($attribute["id"]);
}
if (!($product_attribute_name = $attribute[$attribute_name])) {
$product_attribute_name = $attribute["name"];
}
FormElement::input(array('id' => "attribute-" . $attribute["id"], 'name' => $attribute["id"], 'label' => $product_attribute_name, 'class' => "one-liner" . $smart . $hidden, 'type' => $type, 'more' => true), $list);
}
if ($i > $limit) {
echo '<button type="button" class="view-all-details-btn fullwidth">' . Translate::string("save_advertisement.view_all_attributes") . '</button>';
}
} else {
echo "<p>" . Translate::string("save_advertisement.no_sub_category_info") . "</p>";
}
if ($status == "only-checkboxes") {
?>
<div class="form-element checkbox one-liner hidden">
<span><input type="text" class="detail-checkbox-label" placeholder="<?php
echo Translate::string("form.detail_label");
?>
" name="detail-checkbox-label[0]"></span>
<div class="form-element-wrap">
<div class="add-more-checkbox-wrap">
<input type="checkbox" checked="true"><label></label>
<input autocomplete="off" type="text" name="detail-checkbox-value[0]" class="add-more-checkbox-input">
<div title="<?php
echo Translate::string("form.detail_remove");
?>
" class="remove-checkbox-input">X</div>
</div>
<div class="add-more-checkbox-wrap hidden">
<input type="checkbox" checked="true"><label></label>
<input autocomplete="off" type="text" name="detail-checkbox-value[0]" class="add-more-checkbox-input">
<div title="<?php
echo Translate::string("form.detail_remove");
?>
" class="remove-checkbox-input">X</div>
</div>
<a href="?more" class="btn add-more-checkbox-btn"><?php
echo Translate::string("save_advertisement.add_more_btn");
?>
</a>
</div>
</div>
<?php
} else {
?>
<div class="form-element one-liner smart-search new-info hidden">
<input placeholder="<?php
echo Translate::string("form.detail_label");
?>
" name="detail-label[]" type="text" class="smart-search-attribute">
<input placeholder="<?php
echo Translate::string("form.detail_info");
?>
" name="detail-info[]" type="text" >
<div class="remove-more-derails-input">X</div>
</div>
<?php
}
?>
<button type="button" class="<?php
echo $i > $limit ? " hide-input-element" : "";
?>
add-more-details-btn fullwidth"><?php
echo Translate::string("save_advertisement.add_more_details_btn");
?>
</button> <?php
//.........这里部分代码省略.........
示例2: array
?>
</button>
</form>
<form id="business-register-form" class="hidden" action="lib/ajax/register-business.php" method="post">
<?php
FormElement::input(array('id' => "business-register-company-name", 'placeholder' => Translate::string("register.business_placeholder_your_company_name"), 'name' => "company_name", 'label' => Translate::string("register.business_label_company_name"), 'class' => "one-liner", 'required' => true));
FormElement::input(array('id' => "business-register-company-number", 'placeholder' => Translate::string("register.business_placeholder_your_company_number"), 'name' => "company_number", 'label' => Translate::string("register.business_label_company_number"), 'class' => "one-liner", 'required' => true));
FormElement::input(array('id' => "business-register-company-address", 'placeholder' => Translate::string("register.business_placeholder_your_company_address"), 'name' => "company_address", 'label' => Translate::string("register.business_label_company_address"), 'class' => "one-liner", 'required' => true));
FormElement::input(array('id' => "business-register-company-zip", 'placeholder' => Translate::string("register.business_placeholder_your_company_zip"), 'name' => "company_zip", 'label' => Translate::string("register.business_label_company_zip"), 'class' => "one-liner", 'required' => true));
// version 2
FormElement::input(array('id' => "business-register-name", 'placeholder' => Translate::string("register.placeholder_your_full_name"), 'name' => "name", 'label' => Translate::string("register.label_full_name"), 'class' => "one-liner", 'required' => true));
// version 1
$settings = array('id' => "business-register-email", 'placeholder' => Translate::string("register.placeholder_your_email"), 'name' => "email", 'label' => Translate::string("register.label_email"), 'type' => "email", 'class' => "one-liner", 'required' => true);
$formElement = new FormElement();
$formElement->input($settings);
FormElement::input(array('id' => "business-register-phone", 'placeholder' => Translate::string("register.business_placeholder_1_phone_nr"), 'name' => "phone", 'class' => "one-liner", 'label' => Translate::string("register.business_label_1_phone_nr"), 'required' => true));
FormElement::input(array('id' => "business-register-phone", 'placeholder' => Translate::string("register.business_placeholder_2_phone_nr"), 'name' => "phone_2", 'class' => "one-liner", 'label' => Translate::string("register.business_label_2_phone_nr"), 'required' => false));
FormElement::input(array('id' => "business-register-birthday", 'placeholder' => Translate::string("register.placeholder_your_birthday"), 'name' => "birthday", 'class' => "one-liner", 'label' => Translate::string("register.label_birthday"), 'required' => false));
FormElement::input(array('id' => "business-register-password", 'placeholder' => Translate::string("register.placeholder_your_password"), 'name' => "password", 'class' => "one-liner", 'label' => Translate::string("register.label_password"), 'type' => "password", 'required' => true));
FormElement::input(array('id' => "business-register-password-confirm", 'placeholder' => Translate::string("register.placeholder_confirm_your_password"), 'name' => "confirm_password", 'class' => "one-liner", 'label' => Translate::string("register.label_confirm_password"), 'type' => "password", 'required' => true));
?>
<button type="submit"><?php
echo Translate::string("register.button");
?>
</button>
</form>
<?php
$register_modal_content = ob_get_contents();
ob_end_clean();
// end recording
示例3: ob_start
ob_start();
// Start recording the content for the modal
?>
<form id="reset-password-form" action="lib/ajax/reset-password.php" method="post" >
<input type="hidden" name="token" required="required" value="<?php
echo $_GET["reset-password"];
?>
">
<input type="hidden" name="email" required="required" value="<?php
echo $_GET["email"];
?>
">
<input class="hidden javascript-check" type="checkbox" name="javascript" value="1">
<?php
FormElement::input(array('id' => "new-reset-password", 'name' => "new-reset-password", 'label' => Translate::string("reset_password.new_passoword_label"), 'placeholder' => Translate::string("reset_password.new_passoword_placeholder"), 'type' => "password", 'required' => true));
FormElement::input(array('id' => "confirm-reset-password", 'name' => "confirm-reset-password", 'label' => Translate::string("reset_password.new_passoword_confirm_label"), 'placeholder' => Translate::string("reset_password.new_passoword_confirm_placeholder"), 'type' => "password", 'required' => true));
?>
<button>Reset Password</button>
</form>
<?php
$reset_password_modal_content = ob_get_contents();
ob_end_clean();
// end recording
} else {
$reset_password_modal_content = "<p>" . Translate::string("reset_password.expired_token") . "</p>";
}
$reset_password_modal_id = "reset-password";
$reset_password_modal_title = Translate::string("reset_password.modal_title");
$reset_password_modal_footer = '<a href="#">' . Translate::string("reset_password.modal_footer") . '</a>';
// get the modal
示例4: foreach
*</label>
<select class="btn" id="advert-payment-method" name="paymentMethod">
<?php
$methods = FormElement::getPaymentMethods();
if ($methods) {
foreach ($methods as $method) {
echo '<option value="' . $method['id'] . '">' . $method['method'] . '</option>';
}
}
?>
</select>
</div>
<?php
FormElement::input(array('id' => "advert-zip", 'name' => "zip", 'label' => Translate::string("create_ad_form.postal_code_label") . " *", 'class' => "one-liner", 'required' => true));
FormElement::input(array('id' => "advert-city", 'name' => "city_name", 'label' => Translate::string("create_ad_form.city_name_label") . " *", 'class' => "one-liner", 'required' => true));
?>
<div class="form-element one-liner">
<label for="advert-country-code"><?php
echo Translate::string("create_ad_form.country_label");
?>
*</label>
<select class="btn" id="advert-country-code" name="country_code">
<option value="no">Nor</option>
<option value="se">Swe</option>
<option value="dk">Dk</option>
</select>
</div>
<div class="form-element one-liner">