As title says new version of codefight cms is now released with version number 2.2.1.0 with code name 'Lighter'. In this version I have organized all the libraries and models in sub-folders and wrote helper functions to load them easily when required.
Folder structure looks like this:
app | |_ libraries | |_coffee | |_Coffee_Library.php | |_Coffee_Brand_Library.php | |_models |_coffee |_Coffee_model.php |_Coffee_brand_model.php
So to load a coffee library you would do this:
Library('coffee')->callYourFunction(); //for coffee brand Library('coffee/brand')->callYourFunction();
Same goes for models
Model('coffee')->callYourFunction(); //for coffee brand Model('coffee/brand')->callYourFunction();
How about inlinks?
I have couple of domains and I keep rotating them to see what works best, so if I add static links, I have to go back and update all of them again. So, I created tag parser, which works like this.
{{parse-tag title='CMS'}} //returns: <a href="http://codefight.org/tag/cms" title="CMS">CMS</a> {{parse-tag url='http://d.c/' title='DC' target='_blank'}} //you can add as many params as you want //above will return: <a href="http://d.c/" title="DC" target="_blank">DC</a> {{parse-tag rel='external' title='Twitter' url='http://t.co/'}} //this will return: <a href="http://t.co/" title=" Twitter" rel="external"> Twitter</a> {{parse-tag url='http://codefight.org/'}} //this returns: http://codefight.org/ //and finally, {{parse-tag url='home'}} //return: http://codefight.org/home
Similarly, You can add your own parsers under parser library folder. Check app\libraries\parser\Parser_Tag_Library.php for the code.
To add your parser, crate a library file under parser folder and config like this:
file name: Parser_Yourparser_Library.php
Class: class Parser_Yourparser_Library extends MY_Library
Then you can call your parser in cms pages like this:
{{parse-yourparser key='value' or='What ever you require on your parser'}}
If you create useful parsers, please do share with us. :)
If you like us please show it by liking and sharing us on social network sites.
Thanks!
Damu