One of the most underrated and misunderstood plugins in the Joomla core package is the loadposition plugin. This is really an incredibly flexible solution for adding often used content and markup to your content items as well as simply loading module positions into your Joomla content.
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.
1. Create a new custom html module and create the markup that you are going to use in multiple content items.
2. 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".
3. Name the new module something similar to its function eg loadText.
4. 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.
1. 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.
2. Locate the area that you want to publish the snippet in the content item and type
Noticing that loadText was the position we nominated in the module admin.
3. 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.