Using the loadposition plugin in Joomla
14 Jan 2010 - Written by Anthony Olsen
Posted in Tutorials
During the Joomlabamboo rebuild I found that I was rewriting alot of basic information and so I thought that rather than rewriting it each time Id use the loadposition plugin to do the work. This is a little step by step instruction for using the loadposition plugin on your site as way to repeat or reuse content, images or anything else in your content.
- Create a new custom html module and create the markup that you are going to use in multiple content items.
-
In the dropdown menu that controls the module positions type a name that best suits the function of your snippet. This can be anything but it will be easier when you call the text in the content item if its something that comes to mind. In my case i called the module position "loadText".
-
Name the new module something similar to its function eg loadText.
- Make sure the module is published and assigned to all menu items.
The next step is to create the content item where you want to publish your html snippet.
-
Navigate to the article manager and click new in the top right hand corner, or if you are adding to an already existing item then open the item for editing.
- Locate the area that you want to publish the snippet in the content item and type
{loadposition loadText}
Noticing that loadText was the position we nominated in the module admin.
- Click apply and then navigate to the front end of the site and you should see the snippet that you pasted into your custom module appear in the content item.
Why is this a good thing to use?
Its really a personal preference for how you want to address recurring text in your content but it makes sense to use this technique for signatures, terms and conditions or any other text that you use often on a site.
The loadposition plugin is also very handy (ie what it was designed for) for embedding modules in content items such as galleries, faqs etc. In fact we use it to create the demos for our extensions on the showcase site as well as on the joomlabamboo site.
Are there other ways to do the same thing?
Im sure there are given that Joomla has an abundance of readily available extensions and in fact I used to use mossnippet for similar types of situations in Joomla 1.0 and I believe the Jumi plugin is an excellent option as well.
The benefits to using the loadposition plugin are:
-
Its a part of the core so there is nothing else to install.
-
You get the full benefit of the wysiwyg editor in the module admin, which is something that you dont get with most of the plugins out there that will do the same thing.
-
You can keep the markup isolated which is important if the snippet or the content item you are loading into has a lot of markup or is subject to change.
- Module positions are endless in Joomla 1.5 so it makes sense to use the function to insert snippets into your content.
The major drawback I would see with using this technique is having to handle multiple modules in the module manager. As with all things Joomla I would recommend starting with a clear naming convention for your module positions and semantic titles for the modules you create.
blog comments powered by Disqus