Today we are excited to bring you something new. Most likely something you have never expected. Everyone has heard of Joomla Template Frameworks but Joomla Module framework is something that most of Joomla developers should have. This is first in series of our YJ Module Engines and it is dedicated to Joomla News Items. Upcoming versions might feature other 3rd party Joomla extensions like Virtuemart , RedShop, SOBI or any most used Joomla extension.
Talking about news, how many of your news modules or news sliders are doing exactly the same thing? You always require same parameters right? News item title, news item image, item link etc. We took module development to a new level and combined YJME 1.0 with one of the favorite Joomla extensions. K2 from JoomlaWorks.com. We all know how valuable K2 is to Joomla sphere and that almost 90% Joomla websites are using it.
YJME gives you the option to pick news source from Joomla or K2. Beside that, you can make multiple module copies and combine the news source from Joomla to K2. Note that combining 2 news sources in 1 module instance is not possible. This extension is developed for Joomla 1.5/1.6/1.7 and will be maintained for all upcoming Joomla versions. YJME comes with following features and parameters.
If you in a hurry, use the fast menu to skip to tutorial part you need
YJ Module Engine features:Back to menu
YJ Module Engine News Item settings: Back to menu
Isn’t that a module! Whit these options you can do some nice Joomla magic. But like said those are only options. Let us talk about the actual news engine and explain why it is so special.
News Engine: Back to menu
Let's say, you want to create another module from YJME. As developer you know the steps , copy the module, rename module.php file, rename xml file, rename language.ini file, change php class , change sql query, change variables, and the most annoying one is rename all instances of module name within files mentioned.
We do understand that instances in xml files and language file should be renamed since they are not dynamic. But php files could do better right? If you are using YJME you don't have to look inside module.php or helper.php at all.
To understand better here is how I am making new module instance, and I clocked myself at 46sec. Yes! 46 seconds took me to make a installation file for a completely new YJME powered module.
Creating new module from YJME : Back to menu
All done! You can install your new module . This is only possible in YJME because it is using same variables and classes for both news engines(Joomla or K2) Functions structure is redone to let you use same function when you need it( no functions names clashing).
News sql queries are separated from each other and are requested only when needed, and the best part is , it pulls the actual module name from folder where it resides and redirects all your scripts and module elements based on the folder name. But that is not all.( lol I sound like one of those shopping commercials. Moving on... ).
News item images: Back to menu
The YJME is smart to search through your Joomla news items and pick up first image it finds. If there is none in intro text it will look in full text. Plain and simple. What about K2 images? We all love image sizes variety that K2 has to offer, but I want to present the K2 news items in a slider I am making for YouFact joomla template and none of my image sizes fits the slider size. I would have to do some image size adjustment in K2 settings and re-upload the images again. Hmm. I don’t like that.
No need to do any of mentioned changes if you are using YJME . Leave your K2 images as they are and do this instead:
Now the slider will pick up the image from K2 intro text because it has precedence over default K2 images, and if you follow the link from slider to K2 you will see your news item with K2 image assigned and without the image from intro text. Demo of this setting can be seen on our new Joomla Template YouFact that is using You Fact News Slider powered by YJME .
Module parameters: Back to menu
To make it easier for anyone who would like to create own module based on YJME we have separated the default engine parameters and news item parameters. News item parameters are located in mod_yjme/yjme/params/params.php file and they are changeable. Meaning you can remove them or add your own without affecting the actual news engine.
Please do not forget to edit/remove the xml param tags for the parameters changed/added. Also remove the conditions for the parameters in module template default.php file.
Any additional head files that you would need, for example some javascript files for the slider or custom style tags within page head, can be added in module_name/yjme/headfiles.php file.
Please note that all module files are very well commented and we did our best to explain the usage of all variables/functions/parameters used.
Module templating:Back to menu
By now you have probably heard about module templating. Joomla developers are used to MVC and its usage but for those who do not know what this is here is simple 1on1 in laic terms:
Module templating is nothing else but the html output of your module settings. In Joomla modules, that output file is usually located in module_name/tmlp/default.php. The file name or folder can be different and its name and location are decided by developer.
In YJME and all Youjoomla MVC modules, template is always located here: module_name/tmpl/Template_Name/default.php.
In your YJME module parameters you will see parameter name Select default module template and default selected item from the dropdown select box is Default ( Stands for module_name/tmpl/Template_Name/ ).

With this explained, you can easy understand what parameters, Edit Template and Create Template are there for. They give you the freedom to edit the current module output or create own without going through module folders and files.

If you choose to create new module template the creation process makes a copy of Default module template and assigns the name that you have previously chosen in Create new template window.

After you hit save you will be presented with Creating New Template prompt

Few seconds later you will see Template created message

To edit your module template choose Edit Template button. You will see a modal window with template editor that also has build in CodeMirror code-editor. On top right select template name that you would like to edit and do your magic.

What to add/change you ask? Default module template or the one that you have created will have commented lines on top of the file explaining in detail how to output any of news items parameters and what type of loop to use.

As first one from top you will see //Title: $yj_get_items['item_title'] So by simply echoing this variable within the loop(see line 18 in module template file)
you will see your news items title in your module frontend. We leave you to play around with these settings and make them your own. The possibilities are endless and with some imagination you can make very special Joomla module based on YJME.
YJME CSS control:Back to menu
Just like module templating , you can edit default module CSS file, create own or even upload new one.
The editing process is same as template editing and if you came this far in the tutorial we will not bother you with same explanation. Simply follow the instructions after clicking the upload/edit/create CSS buttons and you will be set in few seconds.


Usage and license:Back to menu
YJ Module Engine is released under GNU/GPL V2 copyleft license. You are free to edit and change any php files but please remember to leave the original copyright intact. Javascript files, CSS files, and images are copyrighted material and are bound by Proprietary License of Youjoomla LLC.