Quick StatsThe Intellispire Software Installer is currently being run by over 10826 people on 20804 websites - including this one!
"the updater, this can really revolutionize joomla…become a must have component for other developers and users as well ..."
|Tuesday, 14 February 2012 02:49|
Introducing the first fully supported Joomla plugin that ads shortcode capability to the both Joomla! 1.5 and 2.5.
Shortcodes are just that, short bits of code that cut down on repetitive strings of HTML, and can be inserted anywhere in your site.
In this short article, I'll give you some examples of functioning shortcodes and how they work.
See the tweet button above? That was added with a one word shortcode: [tweet]
Understanding the Shortcode Engine
Essentially, a shortcode works by doing a search and replace operation on your webpage before it is displayed.
The system comes in two parts: the first is the core "Shortcode Engine" which is a port of the WordPress Shortcode system, packaged as Joomla! plugin. This plugin also has logic to "run" the search and replace system over content items, or optionally, the entire web-page.
Once that's installed, you can install - and activate - shortcode plugins, which are essentially the same as WordPress shortcodes, packaged for Joomla!.
Using the native Joomla! package manager has a number of advantages: first, you can install and uninstall the shortcodes just like any other plugin. Secondly, you can enable / disable each plugin separately and independently of shortcodes in other packages. Finally, you don't have to go in and edit PHP files like functions.php as most WordPress uses do.
That said, we have created a special shortcode plugin called "default" which provides the shortcode_default.php file located under plugins/shortcode in your Joomla installation. You can edit that file just like a functions.php if you wish.
After installing and enabling the Engine (System - Shortcodes) plugin, you can begin to install and enable shortcodes.
Here's few examples of what you can do with the system.
One of my all time favorite shortcodes is "snapshot". This allows you to put a picture of any other website directly in your content, like this:
And it's easy as ... shortbread? [bad pun, sorry]
[snapshot url="http://extensionwebstore.com/store/home.html" alt="Extension Web Store" w="200"]
Hooking up to the Joomla! Internals
Those are all great shortcodes, and can be made to work on any website: WordPress, Joomla!, or (with some work) a hand-crafted site. But my favorite ideas are all connecting up and exposing Joomla! internals with shortcodes. Let me give you an example using the [usercontent] shortcode I created.
Here's the scenerio: you have a membership website that you charge for. Anyone can look at your public content, but your subscribers must be logged in to view the article.
Joomla, that's pretty simple by making the article available to registered users only, on a page by page basis. But what if you want to show a "teaser", then allow only registered users to view the full article - and give visitors a link to your registration form.
Take a look at this option:
[usercontent loggedin="true" default="Please reigster!"] This text is displayed only to LOGGED IN users! The words “Please Reigister” are displayed to users who are not logged in. [/usercontent]
Another feature the user shortcode plugin has is the ability to greet your logged-in users by name, for example:
[user echo="name" default="Guest"]
Would echo the name of the user from database if they were logged in, Guest otherwise.
Personally, I think this is all pretty cool. That's why I've created the Shortcode Pack with the Shortcode Engine, 5+ shortcode plugins, and making them available for purchase as a "pack". Check out the shortcode pack for joomla at the web extension store, which includes the engine plus all shortcodes mentioned above.
What shortcodes would you like to see? Tools? Information on creating your shortcodes? Please stop by the Intellispire Software Blog and let us know what you think!
|Connect on Twitter|
|Connect on Facebook|
Most Intellispire Joomla! Software works with PHP 5.2/5.3 and Joomla 1.5+ (including 2.5) or Wordpress 3.2+. Software is unencoded and licensed under the GPL. Hosting is available.