"> "> " />

Buyruq formasi uchun maxsus plagin

Shaklni qayta ishlash uchun maxsus plagin barpo qilaman. Men maxsus plaginlar uchun yangi bo'lib, bir nechta turli o'quv dasturlarini ko'rib chiqqach, men o'zimning arizamga yopishib qolaman. Men sinfda jarayon shakli usuliga kirishni xohlayman, EE bilan bu to'g'ridir, agar shunday bo'lsa, qanday qilib u haqida ketaman.

Rahmat.

class Myform {

public function __construct()
{
    $this->EE =& get_instance();
}

public function form()
{

    $form_data = array(
        "id"    => $this->EE->TMPL->form_id,
        "class" => $this->EE->TMPL->form_class,
        "action" => //process_form()
    );

    $tagdata = $this->EE->TMPL->tagdata;

    $form = $this->EE->functions->form_declaration($form_data) . $tagdata . "</form>";

    return $form;
}

public function process_form()
{
    return "testing";
}
// --------------------------------------------------------------------

/**
 * Usage
 *
 * Plugin Usage
 *
 * @access  public
 * @return  string
 */
function usage()
{
    ob_start(); 
    ?>

    Documentation will go here

    <?php
    $buffer = ob_get_contents();

    ob_end_clean(); 

    return $buffer;
}

// --------------------------------------------------------------------

} // END SINIFI

0

1 javoblar

Siz plaginini yoki moduli yaratasiz? Amallarni Modullarda ishlatish sababli. Siz keyingi so'rov yordamida tizimga yangi ish qo'shishingiz mumkin (odatda o'rnatish funksiyasi):

$sql[] = "INSERT INTO exp_actions (class, method) VALUES ('module_name', 'my_action_procedure')";

muayyan usul uchun harakat idini qanday olish mumkin:

 $form_data = array(
        "id"    => $this->EE->TMPL->fetch_param('form_id',''),
        "class" => $this->EE->TMPL->fetch_param('form_class',''),
        "action" => ee()->functions->fetch_action_id('module_name', 'process_form');
    );

agar siz modulni ishlab chiqishni istamasangiz, faqatgina foydalanuvchi formasini boshqa forma namunasini qo'shish kabi bazani yaratish uchun berishingiz mumkin

{ext:myform process_uri="home/process" form_id="my-form" form_class="super-form-class"}

uy/jarayon

{ext:my_plugin:process_form}
2
qo'shib qo'ydi
@Bungdaddy - ma'lumotlar bilan qayta yo'naltirishga qanday erishdingiz? Men ham buni xohlayman.
qo'shib qo'ydi muallif Brad Tutterow, manba
$ actionID = ee() -> functions-> fetch_action_id ( CLASS , 'process_form'); maxsus faol yozuvlar so'rovidan yaxshiroqdir.
qo'shib qo'ydi muallif Owen, manba
qabul qilaman. har doim bu haqida unutgan :)
qo'shib qo'ydi muallif Nikos Steiakakis, manba
modul sifatida qayta tiklash, men qo'lga olaman va men ta'qib qilaman
qo'shib qo'ydi muallif Ray Mitchell, manba
@MaxLazar - modul bo'yicha taklif uchun rahmat. Muvaffaqiyatli qurildi! Sizning javobingizni qabul qilaman. Yana bir savol yoki faqat yangi so'rashni ayting ... darhol muvaffaqiyatli postdan so'ng standart xabarni ishlataman, $ this-> EE-> output-> show_message ($ data); Buning o'rniga $ ma'lumotlar bilan yangi sahifaga yo'naltirish yoki teglarni o'rnatish kerakmi? rahmat
qo'shib qo'ydi muallif Ray Mitchell, manba