Login

INTRODUCTION


B2J News Loader for K2 module is one of the first modules produced by Bang2Joom. This module is Based on K2 component. K2 was constructed as a replacement of the default article system in Joomla!.



You can install it like any Joomla! extension,import your articles from the default Joomla! article system and get a host of new features for your current content.If you are not familiar with K2 component,please check K2 Documentation. ,

From the first sight it may seem to be a very simple module, a module that fetches K2 items, and renders them in particular design. But what makes this module unique,is the fact that it uses AJAX technology to fetch more items. The module shows some number of items at the page load, then, when users want to see more items, the module loads more items via AJAX. This provides the module with an ability to show more items, without increasing the page loading time.

The B2J News Loader module has many configurable options, which can help you to get the most suitable look for your website. Note, that the module is also able to create its cache for K2 item's images, with the size specified by user.

FILES


admin/css/b2j_k2_news_loader_admin.css
admin/elements/b2jhidden.php
admin/elements/b2jupdate.php
admin/elements/b2jmargin.php
admin/elements/generatecache.php
admin/elements/b2jgeneratecache.php
admin/js/images/
admin/js/b2j_k2_news_loader_admin.js
admin/js/jscolor.js
admin/images/

language/en-GB/en-GB.mod_b2j_k2_news_loader.ini

tmpl/css/b2j_k2_news_loader.css
tmpl/css/b2j_k2_news_loader_metro.css
tmpl/images/
tmpl/js/b2j_scrollbar.js
tmpl/default.php

helper.php
helper_parameters.php
mod_b2j_k2_news_loader.php
mod_b2j_k2_news_loader.xml

Note, that every folder contains an index.html file. Besides, I skipped all the images containing in images folder to keep the list short and to the point.

Lets start from the files in main folder.

mod_b2j_k2_news_loader.xml is the xml file of the module. It has information about the module itself and the back-end fields.

mod_b2j_k2_news_loader.php is the starting point file of the module. It calls the tmpl/default.php file, which is the view file.mod_b2j_k2_news_loader.php file is also responsible for AJAX calls, so it is being called again and again when module need to fetch more items via AJAX.

helper_parameters.php stores all the back-end field values into variables, which are later used in tmpl/default.php.

helper.php is helper file for the module. This files contains the functionality for image resizing, caching and text manipulations(like limiting introtext).

admin folder is for the backend part of the module.

admin/elements/b2jupdate.php is responsible for updates. If new updates are available, it notifies the user about it.

admin/elements/b2jhidden.php is helper file for back-end, it includes all the necessary files.

admin/elements/b2jmargin.php is a field type, for specifying image margins. It is used in the back-end.

admin/elements/b2jgeneratecache.php and admin/elements/generatecache.php files are responsible for generating cache from the back-end based on some parameters.

tmpl/default.php is the main view file, which renders the module. It has the view HTML and some javascript for handling the AJAX calls.

tmpl/js/b2j_scrollbar.js is a jquery library for adding a scrollbar to views.

tmpl/css/b2j_k2_news_loader.css and tmpl/css/b2j_k2_news_loader_metro.css are the currently available presets. More presets will be available gradually. Note, that when choosing a preset from the back-end,the corresponding css is loaded.

BACKEND


The installation process of B2J News Loader for K2 is as easy as any standard Joomla! module, but there are few steps, which need to be done before the module installation. The first step is to install the K2 component. Please visit getk2.org to download it. After you are done with its installation, you need to create a K2 category, and add some items in it. If you are not familiar with K2 component, check K2 Documentation. The process is almost the same as Joomla! native article management.

B2J News Loader is going to use those items to show them in its view.

Let's take look at the module back-end now. B2J News Loader currently has 5 sections to be configured.

Basic Settings
Ordering of Info Block Parts
Block Settings
Thumbnail Settings
External Files


Basic Settings



Generate Thumbnails - This button creates cache for the module. It is very important, that when you change something concerning to a thumbnail, you need to recreate the cache after saving the changes. Make sure that K2 Category, Thumbnail Width, Thumbnail Height and Max Number of Items are set, otherwise the caching will not work. If your cache is not being recreated, just remove the cached files manually, then click on Recreate Thumbnails again. The cached images for the current module are in mod_b2j_k2_news_loader/cache/m***, where *** is the id of your module. Please note that you need to save the back-end changes, and ONLY after saving use Recreate Thumbnails button.

Preset - you can choose one of the available presets.

Module class suffix - allows you to add a class to calendar parent div.

Module Width - The width of the module.

Select one or more K2 categories - 1 or more K2 categories can be selected here, from where to module will pull the items.

Inherit items from K2 children categories- This parameter decides to fetch items from subcategories(children category) or not.

Order By - The order of the items, you can specify the ordering of the items. When you select ordering "Most Popular" you may also select the period: last week, last month etc.





Maximum Number of Items - The max number of items to retrieve from database. It is recommended to set this number below 50.

Item per View - The number of items retrieved when the module is rendered. Every time when user clicks on 'Load More',exactly this number of new items will be retrieved from database via AJAX.

Block Placement - Specify the ordering of the image and information part (title, introtext, date etc)



Ordering of Info block Parts



In this section you can specify the ordering of the information blocks, which are Author, Date, Comments Count, Title, Introtext, Category and Tags. Every Part can be enabled and disabled. If part is enabled, it can be floated left or right. You can also specify the number of info rows displaying in particular block. You can set the same row number for different blocks, and float them left and right. So, basically you can put every information block, wherever you want, controlling the look of the web-site.

Block Settings





For almost every information block, you can enable or disable links to the corresponding items, categories or whatever context they have.

Title settings - You can customize the title settings by specifying Title Font Size, Title Font Color, Title Limit and Title End. Title limit can be specified in two ways - how many words to show in title ot how many characters to show. The Title End parameter specifies the last character for the title, for example three dots (...) can be added here.



Date and Time Settings - Date Font Size, Date Font Color and Date and Time formats can be specified. PHP formatting is used to format the dates, for example Y-m-d, etc.



Introtext settings - Here the all parameters are the same as the Title settings.



Category Settings- Font Size and Font color can be specified for the Category.



Thumbnail Settings



Create Thumbnail - This options allows you to completely disable thumbnails. If you set this option to 'Off' the parameters below are going to be omitted.

Thumbnail Link - You can specify if the image is going to have link to the item or not.

Thumbnail Creation Type - Thumbnails sizes are specified in the back-end. As the original image sizes may vary, Thumbnail Creation Type option allows you to resize or crop original images, in order to make their size specified.

Keep Aspect Ratio - You can keep aspect ratio from the original image or not.

Thumbnail width - The width for the thumbnail (cached image). After this value is changed, and the back-end configuration is saved, Generate Thumbnails button must be clicked to regenerate the cache with the new size specified here.

Thumbnail height - The width for the thumbnail (cached image). After this value is changed, and the backend configuration is saved, Generate Thumbnails button must be clicked to regenerate the cache with the new size specified here.

Image Margin - Top Right Left and Bottom margins can be specified for the thumbnail.

External files



Use Default CSS - You can disable default css and write your own.

Use Default JS - You can disable default JS and write your own.

FAQ


When I click on Generate Thumbnails, the cache is not refreshed, what do I do.
Probably there is something wrong with permissions. The module is able to create cache, but it can't remove the old cache files first. All you need to do is to remove cached images manually. Go to mod_b2j_k2_news_loader/cache/m***, where *** is the id of your module, and remove the files there,and try Generate Thumbnails again.

What settings do I use to have to display the full month name, not just the abbreviation (Jun) in the module frontend. I have 'M d Y' now.
The date format is done by PHP date functionSo in this case you should have 'F d Y'