I have been developing a EE version of geshi and had a question. As of right now, I have a couple of different options for inserting the data into a table.
Modify each language file to suit the table infrastructure and then use the insert_string by looping through all files. <– Slow so I know I won’t use this
The same as above except put all languages into one big array and then insert each sub-array into the database. <– Worked just fine
Export the contents of the table and then put each INSERT statement into the main ext.geshiee.php file.
My question is where should I actually put these sql statements. I have them currently under activate_extension, but adding these 86 lines with a lot of data makes the file size go up to about .97MB and I have not even started writing the main parse function. Should I take these statements and put them into another file or what. I just don’t want to slow the processing of the data by a large file.
Thanks for any help.
That is what I was thinking about when I decided to go with the DB. Basically, it is a structure like:
LANG_ID LANG_NAME LANG_NAME_R LANG_DATA LANG_ACTIVE
I will be including a settings page where users will be able to configure each language with defaults. Then within the code segment start tag they will be able to modify the default values. From the structure above the user can activate/deactivate languages, modify the entire languge file, and add/delete languages without any programming knowledge or knowledge of how GeSHi works.
My idea behind this is to make it as simple as possible for the user without the user actually needing to know a lot about how these things work.
Cool. The best practice for the general question you are asking, though, is generally to keep it as one file. However, 1MB is very wasteful to include each page load. I’d say you’d be safe to take a page from the IP to Nation module and put your install and update queries in a separate file; just document it well.
I was thinking along the same lines. I hated that it increased the file size that much but that is a lot of data.
Maybe an ext.install_geshiee.php file with the main sql inserts in it and then any updates will be included in the ext.geshiee.php file unless it is a lot of data then I could always make an ext.update_geshiee.php file. Makes it a little confusing but like you said, as long as it is documented well there shouldn’t be a problem.
Thanks for the info and I just got my regex string working. Just a little tweaking of that and rewriting the geshi parse_code will at least let me put something up. Then I will just have to create the settings page. LOL
Thanks again.
Nevermind. I discovered what was slowing it down. Well, this plugin is working and now the configuration part begins. LOL
Things that I need to do:
Once I get through part 2 done I will post a Beta release here for everyone to test. The parsing is a little slow but I am pretty sure there is just too much unneed GeSHi code in there. I basically took the parse_code function and then any function that came up as an error so I would only include the “required” functions.
Again, once I get all of these done I will get something up for testing.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.