Sim Posted May 30, 2020 Share Posted May 30, 2020 To be able to access public methods from other mods. $this->mods->MODNAME->publicMethod(); Say I wanted to commit a crime from my mod. Be able to call this code below from my mod. Ex: $this->mods->crimes->method_commit(); Of course with this example, one would have to adjust the URL to to be able to use this method, but people might start changing there code to include parameters. So $this->mods->crimes->method_commit(3); would commit the crime with ID #3. Why I say this is, with the inventory mod I am creating there's no pretty way to reuse all my methods without modifying a file or two in GL. Quote Link to comment Share on other sites More sharing options...
ags_cs4 Posted May 30, 2020 Share Posted May 30, 2020 nice idea right now Gl need new template engine the one right now crash when there is too many conditions, latly found some time to continue working on my trades but the fist error i get its engine crash 1 Quote Link to comment Share on other sites More sharing options...
Sim Posted May 30, 2020 Author Share Posted May 30, 2020 1 hour ago, ags_cs4 said: nice idea right now Gl need new template engine the one right now crash when there is too many conditions, latly found some time to continue working on my trades but the fist error i get its engine crash I enjoy the template engine. It's fairly simple. I still can't figure out how to do nested eaches with it. Regardless of what temate engine you use, if you have that many conditions, it's still going to be the same concept using another template engine. If if if if else you ECT . I am confused by what yo mean first error to get is engine crash? Quote Link to comment Share on other sites More sharing options...
ags_cs4 Posted May 30, 2020 Share Posted May 30, 2020 some time ur page have lot of if else... so it wont show any thing and with the engine now if u wana have 3 condition in ur page lets say, closed, open, read, you gona need 3 ifs one inside another ... but it would be good to do it like this {#if condition=open}{/if} Quote Link to comment Share on other sites More sharing options...
Sim Posted May 31, 2020 Author Share Posted May 31, 2020 Adding that but isn't a few lines of code. 🙂 Quote Link to comment Share on other sites More sharing options...
ags_cs4 Posted May 31, 2020 Share Posted May 31, 2020 (edited) Its better than passing 50 array var for the temp to show this topic is closed, The tempelate need to be clean My codes are super long and add ajax to it and u get lot of codes Edited May 31, 2020 by ags_cs4 Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted May 31, 2020 Share Posted May 31, 2020 If you're manually passing 50+ arrays to something, you've missed the point of arrays Quote Link to comment Share on other sites More sharing options...
Sim Posted May 31, 2020 Author Share Posted May 31, 2020 3 hours ago, Magictallguy said: If you're manually passing 50+ arrays to something, you've missed the point of arrays What you mean? I think he might hang missed the point of template systems. The only thing template systems are for is to keep the HTML and PHP separate. He is right, the template system does need conditions added to it. I can recall one instance where I had to add multiple variables to add blocks of HTML instead being able to check the template variable value. It would have made things better on the PHP side, but it still produces the same thing. I still rather be able to access other module methods before a template system update. Though both are easy to do. So should add both at once. 🙂 Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted May 31, 2020 Share Posted May 31, 2020 1 hour ago, Sim said: What you mean? [...] Speaking in a broader sense than GL; Why pass 50+ arrays when you can pass 1 multi-dimensional array? Make it easier on yourself at runtime! Quote Link to comment Share on other sites More sharing options...
Sim Posted May 31, 2020 Author Share Posted May 31, 2020 52 minutes ago, Magictallguy said: Speaking in a broader sense than GL; Why pass 50+ arrays when you can pass 1 multi-dimensional array? Make it easier on yourself at runtime! Yup!! Multidimensional arrays don't work with nested eaches though. I can't seem to get nested eaches too work at all in GL Quote Link to comment Share on other sites More sharing options...
sniko Posted May 31, 2020 Share Posted May 31, 2020 3 hours ago, Sim said: Yup!! Multidimensional arrays don't work with nested eaches though. I can't seem to get nested eaches too work at all in GL Yes they do, look into RecursiveArrayIterators - or even if you are passing in a multidimensional array for something, there should be a typed interface for structure validation, so you can iterate on the expected/known leaf keys Quote Link to comment Share on other sites More sharing options...
ags_cs4 Posted May 31, 2020 Share Posted May 31, 2020 5 hours ago, Magictallguy said: Speaking in a broader sense than GL; Why pass 50+ arrays when you can pass 1 multi-dimensional array? Make it easier on yourself at runtime! sim got what i mean, and i use multy dimentional arrays, GL need condition for the template instead i need make 3 variable for each state i have, and do 3 if/unless, some times u need to have up to 3 if/unless inside each other... Quote Link to comment Share on other sites More sharing options...
Sim Posted May 31, 2020 Author Share Posted May 31, 2020 2 hours ago, ags_cs4 said: sim got what i mean, and i use multy dimentional arrays, GL need condition for the template instead i need make 3 variable for each state i have, and do 3 if/unless, some times u need to have up to 3 if/unless inside each other... I didn't say that. MTG did. 3 hours ago, sniko said: Yes they do, look into RecursiveArrayIterators - or even if you are passing in a multidimensional array for something, there should be a typed interface for structure validation, so you can iterate on the expected/known leaf keys Not in GLs template system. I created a topic around here somewhere. Array $bongs $bongs[type] = say 100dimensions $bongs[type][hitter][person] never executes {#Each bong} {Type} {#each hitter} {Person}Never works {/Each} {/Each} Quick example. The second each never cycles threw the array. It only cycles threw the first array. Not multiple dimensions. Quote Link to comment Share on other sites More sharing options...
Sim Posted June 4, 2020 Author Share Posted June 4, 2020 Another request very simple one. Add namespaces to all the admin classes. Although off the top of my head I can't think of one reason why I would need more then one admin class loaded in memory, actually I just did. Reason: can't load more then one admin file in memory. Meaning no one can call functions from other class files. I'll use my item mod for example: pulling the list of items types and item Slots. I could only call one method if loaded the class and have to recreate the same method in my mod file. I basically had to copy and paste at least a hundred lines of code from one mod to another to reuse functions so people wouldn't have to edit any GL files. Of course I will be going back and creating a function mod so I can reuse the code, but it would have been nice to keep the methods in the class file they are associated with. Quote Link to comment Share on other sites More sharing options...
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.