Canjucks Posted October 11, 2021 Posted October 11, 2021 I have been working on the new item system in creating items - new equip items, effects etc that's all cool made it through that. The next phase is re-doing the way the black market is presented which I am now almost done which if not for @ags_cs4 may not have made it that far... Now that I have my layout I need to exclude an item from the list on display. What is throwing me is how to do that using the item types via settings with the new hooks etc on doing this. Using the image below say I want to exclude Melee Weapon. How do I best do this? $item = new Items(); $types = $item->types; foreach ($types as $typeKey => $type) { $type["items"] = $this->db->selectAll("SELECT `I_id` FROM `items` WHERE `I_type` = :type", array( ":type" => $type["id"] )); foreach ($type["items"] as $itemKey => $itemID) { $type["items"][$itemKey] = $item->getItem($itemID["I_id"]); } $types[$typeKey] = $type; } The next bit of the code is about the new hook and publishing the page. I'm not 100% on what can happen in a foreach so if someone was about that can help guide me I really want to learn this as well. Does an If statement like if types[id] != id then continue with sql? Quote
ags_cs4 Posted October 11, 2021 Posted October 11, 2021 if only you want only one key from the array then use this after the foreach unset($types[3]); // 3 is the melee item type id Quote
Canjucks Posted October 11, 2021 Author Posted October 11, 2021 (edited) 3 hours ago, ags_cs4 said: if only you want only one key from the array then use this after the foreach unset($types[3]); // 3 is the melee item type id unset($types[3]); // 3 is the melee item type id Thanks bud did the trick at first didn't see that it had. 🙂 The next thing is that I made the item type disappear but if you manually put it in the url the items will then load. What's the best way to stop that? Edited October 11, 2021 by Canjucks wrong info Quote
ags_cs4 Posted October 11, 2021 Posted October 11, 2021 (edited) will dm ho to do it Edited October 11, 2021 by ags_cs4 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.