This user guide gives an in depth description of Freestyle Includes: Fragments and how to use it including:
- What the product does
- How to install and uninstall
- How to setup and use
This user guide gives an in depth description of Freestyle Includes: Fragments and how to use it including:
Freestyle Includes: Fragments is part of our growing Freestyle Includes range of products.
It allows you to pre-define chunks of HTML and content to be included anywhere on your site by using a simple tag such as:
{frag my-fragment}
If you edit an article you will see the tag displayed, but when viewed on the frontent of your site the tag will be replaced with the content of your fragment!
On your web sites Joomla! administration section (usually http://www.yoursite.com/administrator/), goto the menu "Components" -> "Freestyle Joomla" -> "Includes: Fragments Pro". This is the main control panel for Freestyle Includes: Fragments.
Click the "Fragments" button to display a list of your current fragments on the site.
To create a new fragment, click the "New" button. You will be presented with with a form where you can enter your fragment.
Make sure that you have entered a title for your new fragment. In the "Template" tab, you will be presented with a WYSIWYG editor that is used to define the fragment that will be output. Enter the HTML you wish to display here and then "Save" the fragment.
Once you have created your fragment, return to the fragments list on your Joomla admin section. You should see your new fragment listed.
Against the fragment under the "Tag" column will be listed the tag that is needed to output your new fragment on your site.
{frag my-fragment}
If you include the code in either an article or module on your site, it will be replaced with the template that you defined for the fragment.
If you specified a "Shortcut" for your fragment, then this can also be used to output the fragment. E.g. if the shortcut you specified was "myfrag1" then using the tag
{myfrag1}
will also output your fragment. The shortcut will be also displayed in the "Tag" column.
You can dynamically change the content of a fragment by passing parameters to it within the tag. The parameter will be replaced in the template you created with what has been passed in the tag.
An example of this would be the following fragment:
©{year} - {company} - All rights reserved
Example uses and outputs:
Tag | Output |
---|---|
{frag copyright year="2013" company="My Company"} |
©2013 - My Company - All rights reserved |
{frag copyright year="2001" company="Bills Software Company"} |
©2001 - Bills Software Company - All rights reserved |
In the Pro version of Freestyle Includes: Fragments, you can specify defaults to any parameters for the fragment. Specify these by editing the fragment, and going to the "Preset Parameters" tab.
You specify the parameter defaults in the format:
name="value"
If on the copyright fragment shown earlier the following parameter was specified
year="2010"
company="Default Company"
Some Examples:
Tag | Output |
---|---|
{frag copyright} |
©2010 - Default Company - All rights reserved |
{frag copyright year="2001" company="Bills Software Company"} |
©2001 - Bills Software Company - All rights reserved |
Freestyle Includes: Fragments Pro allows the template to be passed through the Smarty template system. This allows for much greater flexibility of the content your are displaying. The syntax of the Smarty template system is simple but also very powerfull, and there are too many possibilites to be documented here. View the Smarty documentation for a full rundown on its features.
Any parameters that are passed in the tag will be set as variables within the template. The parameters can be displayed by {parameter}
or used in code as $parameter
.
An example fragment using smarty (alias of 'showname'):
{name} - {if $new}NEW!{else}Not new{/if}
With the following preset parameters:
name="Dont forget to enter a name" new=0
Example uses and outputs:
Tag | Output |
---|---|
Dont forget to enter a name - Not new | |
Joe Bloggs - Not new | |
Bob Smith - NEW! |
Another Pro only option is the use of the Code Mirror editor. This replaces the Joomla! WYSIWYG editor with a simple HTML code editor. This will allow you to fully customize the HTML output based with Smarty. An example of this would be (alias of 'proex2'):
<div style='border: 2px solid {color}; {if $bold}font-weight: bold;{/if}'>{title}</div>
Example uses and outputs:
Tag | Output |
---|---|
Some Text
|
|
More Text
|
The settings for Freestyle Includes: Fragments can be found in the "Settings" icon on the main component page ("Components" -> "Freestyle Joomla" -> "Includes: Fragments")
Each of these settings cab also be changed for each fragment individually by editing the fragment cand changing the value in the "Fragments Settings" pane.
* Setting only available in Pro version.
Freestyle Includes: Fragments has the following technical requirements:
All Freestyle Includes components work through a single Joomla! content plugin. For Freestyle Includes: Fragments to function, you must ensure that the "Content - Freestyle Includes" plugin is enabled. To check this, on your Joomla! admin pages, goto "Extensions" -> "Plug-in Manager". Search for "Content - Freestyle Includes" and make sure that the status is checked. If it is not, then clicking the red circle will enable the plugin.
Please ensure that you have the most current version of your copy of Joomla installed. Our components and extensions are developed and tested only with the most recent versions of Joomla.
To install Freestyle Includes: Fragments on your Joomla! site you will need to do the following steps:
To update an existing installation of Freestyle Includes: Fragments you do not need to uninstall the component first. You just need to follow the instructions for installing.
If you have any issues with this process please open a support ticket or post a message in our forums.
To uninstall Freestyle Includes: Fragments you need to log into your Joomla admin backend as described in the installation process.
Goto "Extensions" -> "Extension Manager", then to the "Manage" section.
In the "Filter" enter "Freestyle" and click "Search". This will display a list of all the Freestyle Joomla components that you have installed. Check the box on the left of the list and click the "Uninstall" button on the top right of the page to uninstall a component.
The following components are required by all Freestyle Joomla components and should not be uninstalled unless you are removing all Freestyle products.
Also, if you have any Freestyle Includes products installed, the following compononets and plugins are required and should not be removed unless you are removing all includes products.
You can remove and "Freestyle Joomla Installer" installer items at any time as these are not required by the products, and are just used for installation.