Skip to content

Instantly share code, notes, and snippets.

View lokothodida's full-sized avatar

Lawrence Okoth-Odida lokothodida

View GitHub Profile
@lokothodida
lokothodida / jquery.nestedplugin.js
Last active August 29, 2015 14:24
jQuery Nested Plugins
// This piece of code illustrates how you can build a series of jQuery plugins
// nested on your own desired namespace. So if you have a plugin named 'plugin',
// it can have the signature:
// $(selector).plugin(opts)
// and there can exist jQuery plugins 'module1', 'module2', 'module3', ... which
// have the signatures:
// $(selector).plugin().module1(opts)
// $(selector).plugin().module2(opts)
// $(selector).plugin().module3(opts)
// These modules are written almost exactly like normal jQuery plugins bound
@lokothodida
lokothodida / jquery.nestedplugin.bonus.js
Created July 13, 2015 14:57
jQuery Nested Plugins Bonuses
;(function($, window, document, undefined) {
// == BONUS 1 ==
// Others can add to your modules by extending $.fn.plugin.modules literal
// E.g: (accessed with $(selector).plugin().externalModule(opts))
$.fn.plugin.modules.externalModule = function(opts) {
// Code for this plugin ...
};
// == BONUS 2 ==
@lokothodida
lokothodida / jquery.simplei18n.js
Created July 15, 2015 13:32
jQuery Simple Internationalization (i18n) Support
// This snippet shows how to add simple internationalization (i18n)
// functionality to your jQuery plugin
// The concept is general enough to apply to any library and not just jQuery
// This is based slightly on how elFinder does its i18n functionality
;(function($, window, document, undefined) {
// Create your plugin on the $.fn namespace
// We are using @plugin as an alias so that we can attach properties to it
// later on without having to do $.fn.plugin.propertyName etc
var plugin = $.fn.plugin = function(options) {
@lokothodida
lokothodida / elfinder.src.clean.html
Created July 23, 2015 15:44
A cleaned up version of the elFinder 2.x source HTML file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>elFinder 2.x source version with PHP connector</title>
<script src="jquery/jquery-1.9.1.min.js" type="text/javascript" charset="utf-8"></script>
<script src="jquery/jquery-ui-1.10.1.custom.min.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="jquery/ui-themes/smoothness/jquery-ui-1.10.1.custom.css" type="text/css" media="screen" title="no title" charset="utf-8">
@lokothodida
lokothodida / getsimple-tutorial-i18n-blog-system.md
Last active March 24, 2019 14:40
GetSimple Tutorial for creating a blog with the I18N plugin(s)

GetSimple Tutorial: Creating a blog with the I18N plugin(s)

Ever wanted to have a complete blogging module for GetSimple? Did you know that such a feat is achievable through the use of a number of GetSimple plugins? Look no further than this tutorial in order to discover how to construct such a module yourself!

Plugins that you need

@lokothodida
lokothodida / getsimple-tutorial-i18n-news.md
Created August 16, 2015 19:09
GetSimple tutorial for creating a news system with the i18n plugin(s).

Content Management Systems (CMSs) are pretty self-explanatory: they are dynamic ways of maintaining, displaying and publishing content, and they seek to be intuitive, feature-rich and easy to use. One such a system is GetSimple, a CMS with a tiny zip file-size, and an expansive array of useful plugins to enhance its utility.

Now if you have a site that isn't made up of purely static web-pages, you are going to want to show your visitors flag-points of when certain content was produced or published, and the best way that most CMSs do this is with 'blogging' or 'news publishing' software. There are a number of such plugins available on GetSimple's Plugins Repository, but from what I have tested thus far, long-time plugin developer Mvlcek has produced one of the most extensive and useful plugins for achieving this to date. However some may find it a little difficult to get around, because it is primarily a Search Engine Plugin for allowing visitors to easily search the pages of your si
@lokothodida
lokothodida / getsimple-tutorial-i18n-news-v2.md
Created August 16, 2015 19:11
GetSimple tutorial for creating a news system with the i18n plugin(s) (version 2)

If you have a website, chances are that you'll be updating it at some stage. From minuscule punctuation corrections to changing the banner, it's good to keep your viewers up to scratch on the development of your site. Visitors like to know that they were a part of (or at least informed of) the growth of an entity. Blogs are specifically engineered to be as user-friendly and intuitive as possible when it comes to posting updates, but they aren't necessarily the most potent way to achieve this. As noted in the previous version of this article, other Content Management Systems (of which blogs are a variety) provide much more options with regards to the layout of your site, the displaying of content and the organisation of pages. One such CMS is GetSimple, and plugin developer mvlcek has recently updated his i18n Search plugin to become an incredibly useful and powerful news system.

So how does i18n Search work?

Reading this, I'm assuming that you know what GetSimple is, as well as how to insta
@lokothodida
lokothodida / getsimple-tutorial-i18n-news-v2.md
Created August 16, 2015 19:13
GetSimple tutorial for creating a news system with the i18n plugin(s) (version 3)
@lokothodida
lokothodida / getsimple-tutorial-i18n-randomize-results.md
Last active February 7, 2019 12:11
GetSimple tutorial on providing random search results for i18n search.

Ever wanted to have random items put into the search results pulled from I18N Search?

It's actually not that difficult. The technique hinges on the return_i18n_search_results function, specifically designed for doing custom results rendering.

We call the function with the desired paramters to get the results. To ensure a properly random selection, we'll set the maximum number of results to a high number (e.g. 999).

$search = return_i18n_search_results($tags, $words, 0, 999, $order, $lang);
@lokothodida
lokothodida / getsimple-tutorial-archiving-with-i18n.md
Created August 16, 2015 19:27
GetSimple tutorial for archiving pages (in news/blogging fashion) with i18n.

One feature that I thought was missing from the i18n News system is that of providing automatic archives for news results. However, such a feat is actually achievable with the current i18n Search plugin if you take a moment to think outside of the box...

Plugins you'll need

The importance of tags

Tags are the lifeblood of i18n Search. They are the key to filtering out your results to output exactly the kind of content that you are looking for and ordering them in a sensible way. Initially, tags were simply there as key-words to be involved in the “meta” information of the page – words that would help your site/page be indexed by search engines and found by users. With i18n Search however, these tags can be used to set up virtual categories and a filtering system, provided that you can maintain some kind of logical structure and consistency with the tags that you utilise.