Skocz do zawartości
Hosting webh.pl - 20%

stworzenie inputa

Rekomendowane odpowiedzi

Opublikowano

Witam, próbuję NIE w aplikacji ani wtyczce stworzyć prosty form, jednak dostaję błędem, mój kod:

Cytat

    <?php
        define("ALLOW_FURLS", false);
        // Initialize IPS4 Framework
        require_once( '../init.php' );

        // Indicate that we should consider this a front-end session so we can obtain the currently logged in users information.
        \IPS\Session\Front::i();

        // Grab the currently Logged In user.
        $member = \IPS\Member::loggedIn();
		
		$form = new \IPS\Helpers\Form;
        $form->add(new \IPS\Helpers\Form\Member( 'add_group', null, TRUE ));
        $html = $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'forms', 'core' ) ), 'popupTemplate' ) );
        var_dump($html);

 

I dostaję:

Cytat

RuntimeException: Only subclasses of Dispatcher can be instantiated (0)
#0 /home/development/www/system/Theme/Theme.php(727): IPS\_Dispatcher::i()
#1 [internal function]: IPS\_Theme->getTemplate('forms', 'core')
#2 /home/development/www/panelopiekuna/admins.php(128): call_user_func_array(Array, Array)
#3 {main}

 

Opublikowano
  • Manager
5 minut temu, CamerDisco napisał:

$html = $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'forms', 'core' ) ), 'popupTemplate' ) );

Dlaczego tak? Normalnie daj:

echo (string) $form;

 

intermedia - profesjonalne rozwiązania Invision Power Board, IC5

Opublikowano
  • Autor

Wyrzuca ten sam błąd, mogę natomiast zrobić var_dumpa forma:

object(IPS\Helpers\Form)#10 (19) { ["id"]=> string(4) "form" ["action"]=> object(IPS\Http\Url\Internal)#15 (7) { ["base"]=> NULL ["isInternal"]=> bool(true) ["isFriendly"]=> bool(false) ["url":protected]=> string(62) "http://---/panelopiekuna/admins.php?server=csgo_codmod" ["data"]=> array(8) { ["scheme"]=> string(4) "http" ["host"]=> string(11) "max-play.pl" ["port"]=> NULL ["user"]=> NULL ["pass"]=> NULL ["path"]=> string(25) "/panelopiekuna/admins.php" ["query"]=> string(18) "server=csgo_codmod" ["fragment"]=> NULL } ["queryString"]=> array(1) { ["server"]=> string(11) "csgo_codmod" } ["hiddenQueryString"]=> array(0) { } } ["elements"]=> array(1) { [""]=> array(1) { ["add_group"]=> object(IPS\Helpers\Form\Member)#24 (20) { ["childDefaultOptions"]=> array(1) { ["multiple"]=> int(1) } ["defaultOptions":protected]=> array(12) { ["minLength"]=> NULL ["maxLength"]=> NULL ["size"]=> NULL ["disabled"]=> bool(false) ["autocomplete"]=> array(7) { ["source"]=> string(52) "app=core&module=system&controller=ajax&do=findMember" ["resultItemTemplate"]=> string(28) "core.autocomplete.memberItem" ["commaTrigger"]=> bool(false) ["unique"]=> bool(true) ["minAjaxLength"]=> int(3) ["disallowedCharacters"]=> array(0) { } ["maxItems"]=> int(1) } ["placeholder"]=> NULL ["regex"]=> NULL ["nullLang"]=> NULL ["accountUsername"]=> bool(false) ["trim"]=> bool(true) ["bypassProfanity"]=> bool(false) ["multiple"]=> int(1) } ["formType"]=> string(6) "member" ["_name":protected]=> string(9) "add_group" ["label"]=> NULL ["description"]=> NULL ["defaultValue"]=> NULL ["value"]=> NULL ["unformatted"]=> NULL ["required"]=> bool(true) ["appearRequired"]=> bool(true) ["options"]=> array(12) { ["minLength"]=> int(1) ["maxLength"]=> NULL ["size"]=> NULL ["disabled"]=> bool(false) ["autocomplete"]=> array(7) { ["source"]=> string(52) "app=core&module=system&controller=ajax&do=findMember" ["resultItemTemplate"]=> string(28) "core.autocomplete.memberItem" ["commaTrigger"]=> bool(false) ["unique"]=> bool(true) ["minAjaxLength"]=> int(3) ["disallowedCharacters"]=> array(0) { } ["maxItems"]=> int(1) } ["placeholder"]=> NULL ["regex"]=> NULL ["nullLang"]=> NULL ["accountUsername"]=> bool(false) ["trim"]=> bool(true) ["bypassProfanity"]=> bool(false) ["multiple"]=> int(1) } ["customValidationCode":protected]=> NULL ["prefix"]=> NULL ["suffix"]=> NULL ["htmlId"]=> string(0) "" ["error"]=> NULL ["reloadForm"]=> bool(false) ["warningBox"]=> NULL ["valueSet"]=> bool(false) } } } ["tabs":protected]=> array(0) { } ["currentTab":protected]=> string(0) "" ["activeTab"]=> NULL ["tabClasses":protected]=> array(0) { } ["sidebar"]=> array(0) { } ["class"]=> string(18) "ipsForm_horizontal" ["error"]=> string(0) "" ["hiddenValues"]=> array(1) { ["csrfKey"]=> string(32) "8ccf0eaacfd85618372d62e4030e87ee" } ["attributes"]=> array(0) { } ["actionButtons"]=> array(1) { [0]=> string(147) " " } ["uploadField":protected]=> float(51380224) ["ajaxOutput"]=> bool(false) ["iconTabs":protected]=> bool(false) ["copyButton"]=> NULL ["languageKeys":protected]=> array(0) { } ["canSaveAndReload"]=> bool(false) } 

Chociaż przy sposobie z echo log błędu jest większy:

RuntimeException: Only subclasses of Dispatcher can be instantiated (0)
#0 /home/development/www/system/Theme/Theme.php(824) : eval()'d code(7004): IPS\_Dispatcher::i()
#1 /home/development/www/system/Theme/SandboxedTemplate.php(56): IPS\Theme\class_core_global_forms->rowDesc('c6993b0a838e79d...', '\n\r\n\r\n\r\n\t\n\r\n\r\n\r\n...', true, NULL, NULL, NULL, 'form_add_group', Object(IPS\Helpers\Form\Member), Object(IPS\Helpers\Form))
#2 /home/development/www/system/Helpers/Form/FormAbstract.php(273): IPS\Theme\_SandboxedTemplate->__call('rowDesc', Array)
#3 /home/development/www/system/Helpers/Form/FormAbstract.php(273): IPS\Theme\SandboxedTemplate->rowDesc('c6993b0a838e79d...', '\n\r\n\r\n\r\n\t\n\r\n\r\n\r\n...', true, NULL, NULL, NULL, 'form_add_group', Object(IPS\Helpers\Form\Member), Object(IPS\Helpers\Form))
#4 /home/development/www/system/Helpers/Form/Form.php(415): IPS\Helpers\Form\_FormAbstract->rowHtml(Object(IPS\Helpers\Form))
#5 /home/development/www/panelopiekuna/admins.php(128): IPS\Helpers\_Form->__toString()
#6 {main}

 

Edytowane przez CamerDisco

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Ostatnio przeglądający 0

  • Brak zarejestrowanych użytkowników przeglądających tę stronę.

Konto

Nawigacja

Szukaj

Szukaj

Skonfiguruj powiadomienia push w przeglądarce

Chrome (Android)
  1. Stuknij ikonę kłódki obok paska adresu.
  2. Stuknij Uprawnienia → Powiadomienia.
  3. Dostosuj swoje ustawienie.
Chrome (Komputer)
  1. Kliknij ikonę kłódki na pasku adresu.
  2. Wybierz Ustawienia witryny.
  3. Znajdź Powiadomienia i dostosuj swoje ustawienie.