So I was looking at some of my site statistics today, and one of them happened to be a referrer from the search engine term “smf package parser”. And when I saw that, I opened a new tab to Google, and typed in those same exact terms, and saw that my package parser came up as the 6th result on Google!
Just to give a little background history on how I made my own parser, I found myself constantly using Daniel15’s package parser, and looked into the source a bit to see how it works. The thing about the package parser that he wrote was that it didn’t parse bbcode in the readme, and didn’t support boardmod modifications. Plus, it was really outdated and slowly stopped being developed as Daniel15 grew interests in other things. Then, I thought to myself, what if I was to code my very own package parser for the SMF community, and made it better, more helpful, and up-to-date? And so with Curve already available, I construct a brand new package parser basing the design off of Daniel15’s parser and building a new one from the ground up.
With this, I had to familiarize myself with objects and how they worked, as I had to work with the SimpleXMLElement function in PHP. It wasn’t too hard to do, so I caught on pretty quickly. I knew how I wanted the parser to look, and focused on visuals, working around the curve theme, and made it look neat. The part that took me the longest to do though was the support of boardmod (.mod) modifications. They’re pretty rare since most SMF mods use the XML format, but there are still some mods out there that are written boardmod format. When I thought of how I would do it, I decided to convert the boardmod to XML.
This was going to be a great challenge for me, but I didn’t give up. I was determined to convert boardmod files to XML, that I had no idea what was in store for me. It took me several regex functions and syntax to successfully convert the boardmod to XML, making sure each operation and such would be converted correctly to the right XML format. I literally spent hours making sure that it would convert properly, and as I was writing out the conversion process, I realized how much lines of code I was taking. And everything is located in one file too. That’s actually the amazing part of this particular package parser. Everything is one file. Daniel15’s version of the mod had multiple files associated with it to support multiple languages, PHP syntax highlighting, and images so that it wouldn’t have to take them from SMF’s Theme directory. My version is basically like a ssi_examples.php page, and wraps nicely into SMF’s theme files for me to use. When I say that, I mean the parser uses images from the default theme folder, to replicate the Curve theme, just like how ssi_examples.php does. The parser doesn’t support multiple languages though, and it doesn’t highlight the PHP code when you perform the manual installation. Instead of doing that however, all the code is put into a textarea (a large text box) and you can have it select the code with the click of the mouse, and you can do a control (command) C to copy the text, and do a paste where neccessary. It works the same way when you’re searching for the code to replace or add before/after with control (command) F to find the code when you select and copy the code to find. Everything is in one PHP file.
I can go on and on about the features of the package parser, but this article will be a bit too long for that. What you can do though is try out the package parser yourself and see if it’s useful to you. If you like, you may link to it from other sites. Please, share the parser at your will!
I had to tell people of the package parser in order for people to see and use it, so I posted a topic about it at the SMF community, and so far it’s gotten great feedback and people are wanting to use it on their own sites/forum! The source of the package parser can actually be found right here, and you may use it on your own site. Oh, but please be sure to read my notes on the parser before you download the source. These notes can be found right here.