BooyaK
Użytkownik-
Postów
9 -
Dołączył
-
Ostatnia wizyta
Typ zawartości
Profile
Forum
Pliki
Galeria
Blogi
Sklep
Wydarzenia
Treść opublikowana przez BooyaK
-
Tworzenie wpisu do bazy danych
BooyaK odpowiedział(a) na BooyaK temat w Programowanie / tworzenie styli
Zrobiłem coś takiego public function makeOffert() { if (isset(\IPS\Request::i()->AddOffer)) { $offer = \IPS\Request::i()->AddOffer; $member = \IPS\Member::loggedIn()->member_id; $date = time(); \IPS\Db::i()->insert('auctions', [ 'auction_id' => $auctionId, 'auction_uid' => $auctionUid, 'auction_priority' => $auctionPriority, 'auction_buynow' => $auctionBuyNow, 'auction_startprice' => $auctionStartPrice, 'auction_owner' => $member, 'auction_date' => $auctionDate, 'auction_type' => $auctionType ]); // Redirect to main \IPS\Output::i()->redirect(\IPS\Http\Url::internal("app=game&module=character", 'front'), \IPS\Member::loggedIn()->language()->addToStack('Pomyślnie dodano zmianę.')); } } I tutaj HTML: {{if \IPS\Request::i()->action == 'makeOffert' }} <div> <h2>Dodaj ofertę</h2> <form action="https://v-inside.pl/forum/index.php?app=game&module=character&controller=makeOffert" method="POST"> <input type="text" name="offer_title" placeholder="Tytuł oferty" required> <textarea name="offer_description" placeholder="Opis oferty" required></textarea> <input type="submit" value="Dodaj ofertę"> </form> </div> {{else}}[DALSZA CZĘŚĆ KODU] Pojawia mi się Brak strony, nie wiem co robię źle ponieważ po naciśnięciu DODAJ pokazuje mi się Ta strona nie istnieje. -
Tworzenie wpisu do bazy danych
BooyaK odpowiedział(a) na BooyaK temat w Programowanie / tworzenie styli
Posiadam panel gry który został mi sprzedany dawno temu a teraz chce go po prostu przerobić bo jest troszkę uszkodzony, raczkuję na ten moment. Szukam przykładów i porad. Przepraszam za kłopot -
Hej ponownie, miałem problem z kodem który opisałem w innym temacie. Chciałbym stworzyć dodawanie ofert ale kompletnie nie wiem jak się za to zabrać Mój szablon: <h2 class="ipsType_sectionTitle ipsType_reset cForumTitle">Market / W trakcie budowy.</h2> <hr class="ipsHr"> {{if \IPS\Request::i()->action == 'makeOffert' }} Tutaj będziesz mógł dodać ofertę. {{else}} <div class="ipsTabs saTabs ipsClearfix" id="ticketsTabs" data-ipstabbar="" data-ipstabbar-contentarea="#ticketsTabContent"> <ul role="tablist" class="ipsList_reset" style="float: left"> <a class="ipsTabs_item saTabs_item ipsTabs_activeItem" id="cat_items" role="tab" aria-selected="true"> <span class="saTabs_count" data-action="quickToggleCount"> <i class="fa fa-phone"></i></span> Przedmioty </a> <a class="ipsTabs_item saTabs_item" id="cat_cars" role="tab"> <span class="saTabs_count" data-action="quickToggleCount"> <i class="fa fa-car"></i></span> Pojazdy </a> <a class="ipsTabs_item saTabs_item" id="cat_doors" role="tab"> <span class="saTabs_count" data-action="quickToggleCount"><i class="fa fa-home"></i></span> Posiadłości </a> </ul> <a href="index.php?/character/&tab=market&action=makeOffert" data-ipsdialog-title="Dodawanie oferty" style="float: right; padding-top: 10px; padding-right: 10px;"> <span class="ipsBadge ipsBadge_large ipsBadge_intermediary"> <i class="fa fa-plus"></i> Dodaj oferte </span> </a> </div> <section id="ticketsTabContent"> <div id="ipsTabs_ticketsTabs_cat_items_panel" class="ipsTabs_panel" aria-labelledby="cat_items" aria-hidden="false" style="display: block;" animating="false"> <ol class="ipsBox ipsDataList ipsDataList_large ipsDataList_zebra ipsAreaBackground_reset cForumList" data-role="market" style="border-top: 0;"> <div style="padding: 25px;"> {{foreach $results as $row}} <li class="cForumRow ipsDataItem ipsDataItem_responsivePhoto ipsClearfix"> <div class="ipsDataItem_main" style="vertical-align: middle"> <h4 class="ipsDataItem_title ipsType_large ipsType_break"> {{if $row['auction_priority'] == 1}} <span class="ipsBadge ipsBadge_large ipsBadge_intermediary">Sponsorowane</span> {{endif}} <a href="index.php?/character/&tab=market&viewMarketItem={$row['auction_id']}">{$row['auction_uid']}</a> </h4> </div> <ul class="ipsDataItem_lastPoster ipsDataItem_withPhoto" style="text-align: center"> <li class="ipsType_success"> <span class="ipsBadge ipsBadge_medium ipsBadge_positive"> <strong><i class="fa fa-handshake-o"></i> <i class="fa fa-usd" style="font-size: 95%"></i>{$row['auction_buynow']}</strong> </span> </li> {{if $row['auction_startprice'] == 0}} <li class="ipsType_light"> - </li> {{else}} <li class="ipsType_light"> <span class="ipsBadge ipsBadge_medium ipsBadge_neutral"> <strong><i class="fa fa-gavel"></i> <i class="fa fa-usd" style="font-size: 95%"></i>{$row['auction_startprice']}</strong> </span> </li> {{endif}} </ul> <ul class="ipsDataItem_lastPoster ipsDataItem_withPhoto" style="text-align: center"> <li> <strong>{$row['auction_owner']}</strong> </li> <li> {datetime="$row['auction_date']"} </li> </ul> </li> {{endforeach}} </div> </ol> </div> <div id="ipsTabs_ticketsTabs_cat_cars_panel" class="ipsTabs_panel" aria-labelledby="cat_cars" aria-hidden="false" style="display: block;" animating="false"> <ol class="ipsBox ipsDataList ipsDataList_large ipsDataList_zebra ipsAreaBackground_reset cForumList" data-role="market" style="border-top: 0;"> <div style="padding: 25px;"> {{if !$results}} Brak wystawionych ofert {{else}} {{foreach $results as $row}} <li class="cForumRow ipsDataItem ipsDataItem_responsivePhoto ipsClearfix"> <div class="ipsDataItem_main" style="vertical-align: middle"> <h4 class="ipsDataItem_title ipsType_large ipsType_break"> {{if $row['auction_priority'] == 1}} <span class="ipsBadge ipsBadge_large ipsBadge_intermediary">Sponsorowane</span> {{endif}} <a href="index.php?/character/&tab=market&viewMarket={$row['auction_id']}">{$row['name']}</a> </h4> </div> <ul class="ipsDataItem_lastPoster ipsDataItem_withPhoto" style="text-align: center"> <li class="ipsType_success"> <span class="ipsBadge ipsBadge_medium ipsBadge_positive"> <strong><i class="fa fa-handshake-o"></i> <i class="fa fa-usd" style="font-size: 95%"></i>{$row['auction_buynow']}</strong> </span> </li> {{if $row['auction_startprice'] == 0}} <li class="ipsType_light"> - </li> {{else}} <li class="ipsType_light"> <span class="ipsBadge ipsBadge_medium ipsBadge_neutral"> <strong><i class="fa fa-gavel"></i> <i class="fa fa-usd" style="font-size: 95%"></i>{$row['auction_startprice']}</strong> </span> </li> {{endif}} </ul> <ul class="ipsDataItem_lastPoster ipsDataItem_withPhoto" style="text-align: center"> <li> <strong>{$row['auction_owner']}</strong> </li> <li> {datetime="$row['auction_date']"} </li> </ul> </li> {{endforeach}} {{endif}} </div> </ol> </div> <div id="ipsTabs_ticketsTabs_cat_doors_panel" class="ipsTabs_panel" aria-labelledby="cat_doors" aria-hidden="false" style="display: block;" animating="false"> <ol class="ipsBox ipsDataList ipsDataList_large ipsDataList_zebra ipsAreaBackground_reset cForumList" data-role="market" style="border-top: 0;"> <div style="padding: 25px;"> {{if !$results}} Brak wystawionych ofert {{else}} {{foreach $results as $row}} <li class="cForumRow ipsDataItem ipsDataItem_responsivePhoto ipsClearfix"> <div class="ipsDataItem_main" style="vertical-align: middle"> <h4 class="ipsDataItem_title ipsType_large ipsType_break"> {{if $row['auction_priority'] == 1}} <span class="ipsBadge ipsBadge_large ipsBadge_intermediary">Sponsorowane</span> {{endif}} <a href="index.php?/character/&tab=market&viewMarket={$row['auction_id']}">{$row['nazwa']}</a> </h4> </div> <ul class="ipsDataItem_lastPoster ipsDataItem_withPhoto" style="text-align: center"> <li class="ipsType_success"> <span class="ipsBadge ipsBadge_medium ipsBadge_positive"> <strong><i class="fa fa-handshake-o"></i> <i class="fa fa-usd" style="font-size: 95%"></i>{$row['auction_buynow']}</strong> </span> </li> {{if $row['auction_startprice'] == 0}} <li class="ipsType_light"> - </li> {{else}} <li class="ipsType_light"> <span class="ipsBadge ipsBadge_medium ipsBadge_neutral"> <strong><i class="fa fa-gavel"></i> <i class="fa fa-usd" style="font-size: 95%"></i>{$row['auction_startprice']}</strong> </span> </li> {{endif}} </ul> <ul class="ipsDataItem_lastPoster ipsDataItem_withPhoto" style="text-align: center"> <li> <strong>{$row['auction_owner']}</strong> </li> <li> {datetime="$row['auction_date']"} </li> </ul> </li> {{endforeach}} {{endif}} </div> </ol> </div> </section> {{endif}} Mój kod PHP: protected function _market() { $results = []; foreach( \IPS\Db::i()->select( '*', 'auctions' ) as $row ) { $results[] = $row; } return \IPS\Theme::i()->getTemplate('character')->tabMarket($results); }
-
Dziękuję za pomoc, czy jesteś w stanie pomóc mi jeszcze z czymś?
-
<h2 class="ipsType_sectionTitle ipsType_reset cForumTitle">Market / W trakcie budowy.</h2> <hr class="ipsHr"> {{if \IPS\Request::i()->action == 'makeOffert' }} Tutaj będziesz mógł dodać ofertę. {{else}} <div class="ipsTabs saTabs ipsClearfix" id="ticketsTabs" data-ipstabbar="" data-ipstabbar-contentarea="#ticketsTabContent"> <ul role="tablist" class="ipsList_reset" style="float: left"> <a class="ipsTabs_item saTabs_item ipsTabs_activeItem" id="cat_items" role="tab" aria-selected="true"> <span class="saTabs_count" data-action="quickToggleCount"> <i class="fa fa-phone"></i></span> Przedmioty </a> <a class="ipsTabs_item saTabs_item" id="cat_cars" role="tab"> <span class="saTabs_count" data-action="quickToggleCount"> <i class="fa fa-car"></i></span> Pojazdy </a> <a class="ipsTabs_item saTabs_item" id="cat_doors" role="tab"> <span class="saTabs_count" data-action="quickToggleCount"><i class="fa fa-home"></i></span> Posiadłości </a> </ul> <a href="index.php?/character/&tab=market&action=makeOffert" data-ipsdialog-title="Dodawanie oferty" style="float: right; padding-top: 10px; padding-right: 10px;"> <span class="ipsBadge ipsBadge_large ipsBadge_intermediary"> <i class="fa fa-plus"></i> Dodaj oferte </span> </a> </div> <section id="ticketsTabContent"> <div id="ipsTabs_ticketsTabs_cat_items_panel" class="ipsTabs_panel" aria-labelledby="cat_items" aria-hidden="false" style="display: block;" animating="false"> <ol class="ipsBox ipsDataList ipsDataList_large ipsDataList_zebra ipsAreaBackground_reset cForumList" data-role="market" style="border-top: 0;"> <div style="padding: 25px;"> {{foreach $marketItems as $row}} <li class="cForumRow ipsDataItem ipsDataItem_responsivePhoto ipsClearfix"> <div class="ipsDataItem_main" style="vertical-align: middle"> <h4 class="ipsDataItem_title ipsType_large ipsType_break"> {{if $row['auction_priority'] == 1}} <span class="ipsBadge ipsBadge_large ipsBadge_intermediary">Sponsorowane</span> {{endif}} <a href="index.php?/character/&tab=market&viewMarketItem={$row['auction_id']}">{$row['auction_uid']}</a> </h4> </div> <ul class="ipsDataItem_lastPoster ipsDataItem_withPhoto" style="text-align: center"> <li class="ipsType_success"> <span class="ipsBadge ipsBadge_medium ipsBadge_positive"> <strong><i class="fa fa-handshake-o"></i> <i class="fa fa-usd" style="font-size: 95%"></i>{$row['auction_buynow']}</strong> </span> </li> {{if $row['auction_startprice'] == 0}} <li class="ipsType_light"> - </li> {{else}} <li class="ipsType_light"> <span class="ipsBadge ipsBadge_medium ipsBadge_neutral"> <strong><i class="fa fa-gavel"></i> <i class="fa fa-usd" style="font-size: 95%"></i>{$row['auction_startprice']}</strong> </span> </li> {{endif}} </ul> <ul class="ipsDataItem_lastPoster ipsDataItem_withPhoto" style="text-align: center"> <li> <strong>{$row['auction_owner']}</strong> </li> <li> {datetime="$row['auction_date']"} </li> </ul> </li> {{endforeach}} </div> </ol> </div> <div id="ipsTabs_ticketsTabs_cat_cars_panel" class="ipsTabs_panel" aria-labelledby="cat_cars" aria-hidden="false" style="display: block;" animating="false"> <ol class="ipsBox ipsDataList ipsDataList_large ipsDataList_zebra ipsAreaBackground_reset cForumList" data-role="market" style="border-top: 0;"> <div style="padding: 25px;"> {{if !$marketCars}} Brak wystawionych ofert {{else}} {{foreach $marketCars as $row}} <li class="cForumRow ipsDataItem ipsDataItem_responsivePhoto ipsClearfix"> <div class="ipsDataItem_main" style="vertical-align: middle"> <h4 class="ipsDataItem_title ipsType_large ipsType_break"> {{if $row['auction_priority'] == 1}} <span class="ipsBadge ipsBadge_large ipsBadge_intermediary">Sponsorowane</span> {{endif}} <a href="index.php?/character/&tab=market&viewMarket={$row['auction_id']}">{$row['name']}</a> </h4> </div> <ul class="ipsDataItem_lastPoster ipsDataItem_withPhoto" style="text-align: center"> <li class="ipsType_success"> <span class="ipsBadge ipsBadge_medium ipsBadge_positive"> <strong><i class="fa fa-handshake-o"></i> <i class="fa fa-usd" style="font-size: 95%"></i>{$row['auction_buynow']}</strong> </span> </li> {{if $row['auction_startprice'] == 0}} <li class="ipsType_light"> - </li> {{else}} <li class="ipsType_light"> <span class="ipsBadge ipsBadge_medium ipsBadge_neutral"> <strong><i class="fa fa-gavel"></i> <i class="fa fa-usd" style="font-size: 95%"></i>{$row['auction_startprice']}</strong> </span> </li> {{endif}} </ul> <ul class="ipsDataItem_lastPoster ipsDataItem_withPhoto" style="text-align: center"> <li> <strong>{$row['auction_owner']}</strong> </li> <li> {datetime="$row['auction_date']"} </li> </ul> </li> {{endforeach}} {{endif}} </div> </ol> </div> <div id="ipsTabs_ticketsTabs_cat_doors_panel" class="ipsTabs_panel" aria-labelledby="cat_doors" aria-hidden="false" style="display: block;" animating="false"> <ol class="ipsBox ipsDataList ipsDataList_large ipsDataList_zebra ipsAreaBackground_reset cForumList" data-role="market" style="border-top: 0;"> <div style="padding: 25px;"> {{if !$marketDoors}} Brak wystawionych ofert {{else}} {{foreach $marketDoors as $row}} <li class="cForumRow ipsDataItem ipsDataItem_responsivePhoto ipsClearfix"> <div class="ipsDataItem_main" style="vertical-align: middle"> <h4 class="ipsDataItem_title ipsType_large ipsType_break"> {{if $row['auction_priority'] == 1}} <span class="ipsBadge ipsBadge_large ipsBadge_intermediary">Sponsorowane</span> {{endif}} <a href="index.php?/character/&tab=market&viewMarket={$row['auction_id']}">{$row['nazwa']}</a> </h4> </div> <ul class="ipsDataItem_lastPoster ipsDataItem_withPhoto" style="text-align: center"> <li class="ipsType_success"> <span class="ipsBadge ipsBadge_medium ipsBadge_positive"> <strong><i class="fa fa-handshake-o"></i> <i class="fa fa-usd" style="font-size: 95%"></i>{$row['auction_buynow']}</strong> </span> </li> {{if $row['auction_startprice'] == 0}} <li class="ipsType_light"> - </li> {{else}} <li class="ipsType_light"> <span class="ipsBadge ipsBadge_medium ipsBadge_neutral"> <strong><i class="fa fa-gavel"></i> <i class="fa fa-usd" style="font-size: 95%"></i>{$row['auction_startprice']}</strong> </span> </li> {{endif}} </ul> <ul class="ipsDataItem_lastPoster ipsDataItem_withPhoto" style="text-align: center"> <li> <strong>{$row['auction_owner']}</strong> </li> <li> {datetime="$row['auction_date']"} </li> </ul> </li> {{endforeach}} {{endif}} </div> </ol> </div> </section> {{endif}} PHP: protected function _market() { $marketCars = \IPS\Db::i()->select( '*', 'auctions', array('auction_type = 1') )->first(); $marketItems = \IPS\Db::i()->select( '*', 'auctions', array('auction_type = 2') ); $marketDoors = \IPS\Db::i()->select( '*', 'auctions', array('auction_type = 3') ); $results = []; foreach( \IPS\Db::i()->select( '*', 'auctions' ) as $row ) { $results[] = $row; } /* Return */ return \IPS\Theme::i()->getTemplate('character')->tabMarket($marketItems, $marketCars, $marketDoors ); }
-
Teraz mam takie coś: UnderflowException: (0) #0 /var/www/html/forum/applications/game/modules/front/character/character.php(492): IPS\Db\_Select->first() #1 [internal function]: IPS\game\modules\front\character\_character->_market() #2 /var/www/html/forum/applications/game/modules/front/character/character.php(47): call_user_func() #3 /var/www/html/forum/system/Dispatcher/Controller.php(118): IPS\game\modules\front\character\_character->manage() #4 /var/www/html/forum/applications/game/modules/front/character/character.php(26): IPS\Dispatcher\_Controller->execute() #5 /var/www/html/forum/system/Dispatcher/Dispatcher.php(153): IPS\game\modules\front\character\_character->execute() #6 /var/www/html/forum/index.php(13): IPS\_Dispatcher->run() #7 {main}
-
Ahh.. tak, wybacz - zapomniałem Error: Undefined constant "IPS\Theme\marketCars" in /var/www/html/forum/system/Theme/Theme.php(885) : eval()'d code:2865 Stack trace: #0 /var/www/html/forum/system/Theme/SandboxedTemplate.php(61): IPS\Theme\class_game_front_character->tabMarket() #1 /var/www/html/forum/applications/game/modules/front/character/character.php(488): IPS\Theme\_SandboxedTemplate->__call() #2 [internal function]: IPS\game\modules\front\character\_character->_market() #3 /var/www/html/forum/applications/game/modules/front/character/character.php(47): call_user_func() #4 /var/www/html/forum/system/Dispatcher/Controller.php(118): IPS\game\modules\front\character\_character->manage() #5 /var/www/html/forum/applications/game/modules/front/character/character.php(26): IPS\Dispatcher\_Controller->execute() #6 /var/www/html/forum/system/Dispatcher/Dispatcher.php(153): IPS\game\modules\front\character\_character->execute() #7 /var/www/html/forum/index.php(13): IPS\_Dispatcher->run() #8 {main}
-
Posiadam taki kod: {{if !marketCars}} Brak wystawionych ofert {{else}} {{foreach $marketCars as $row}} <li class="cForumRow ipsDataItem ipsDataItem_responsivePhoto ipsClearfix"> <div class="ipsDataItem_main" style="vertical-align: middle"> <h4 class="ipsDataItem_title ipsType_large ipsType_break"> {{if $row['auction_priority'] == 1}} <span class="ipsBadge ipsBadge_large ipsBadge_intermediary">Sponsorowane</span> {{endif}} <a href="index.php?/character/&tab=market&viewMarket={$row['auction_id']}">{$row['name']}</a> </h4> </div> <ul class="ipsDataItem_lastPoster ipsDataItem_withPhoto" style="text-align: center"> <li class="ipsType_success"> <span class="ipsBadge ipsBadge_medium ipsBadge_positive"> <strong><i class="fa fa-handshake-o"></i> <i class="fa fa-usd" style="font-size: 95%"></i>{$row['auction_buynow']}</strong> </span> </li> {{if $row['auction_startprice'] == 0}} <li class="ipsType_light"> - </li> {{else}} <li class="ipsType_light"> <span class="ipsBadge ipsBadge_medium ipsBadge_neutral"> <strong><i class="fa fa-gavel"></i> <i class="fa fa-usd" style="font-size: 95%"></i>{$row['auction_startprice']}</strong> </span> </li> {{endif}} </ul> <ul class="ipsDataItem_lastPoster ipsDataItem_withPhoto" style="text-align: center"> <li> <strong>{$row['auction_owner']}</strong> </li> <li> {datetime="$row['auction_date']"} </li> </ul> </li> {{endforeach}} {{endif}} </div> </ol> </div> Chciałbym aby $row pobierało dane z MYSQL.. ucze sie dopiero tego wszystkiego więc może robie coś źle :c
-
Hej. Nie wiem czy coś źle robię protected function _market() { $marketCars = \IPS\Db::i()->select( '*', 'auctions', array('auction_type = 1') ); $marketItems = \IPS\Db::i()->select( '*', 'auctions', array('auction_type = 2') ); $marketDoors = \IPS\Db::i()->select( '*', 'auctions', array('auction_type = 3') ); /* Return */ return \IPS\Theme::i()->getTemplate('character')->market($marketItems, $marketCars, $marketDoors ); } Poproszę o pomoc!