1. Fabrik 3.5.2 is now available to download. Read the blog for highlights about this release.

    As always, please back up your site prior to updating and if possible test in a dev environment first.

    Also, our 3.5.1 package file was hacked, the effected dates were 1/15/2017 - 1/17/2017. If during those days you downloaded the 3.5.1 package file from the JED or our site download page, please re-install the package with a fresh copy or upgrade to Fabrik 3.5.2. Github downloads were not effected.

Content plugin

Nov 10, 2016
Content plugin
  • The Fabrik content plug-in allows you to embed Fabrik content within your Joomla articles


    Embedding Forms(top)

    Add a new record into a form whose ID is 1:
    Code (Text):
    {fabrik view=form id=1}
    Add a new record into a form whose ID is 1 and passing parameters to fill elements :
    Code (Text):
    {fabrik view=form id=1 table___element_1=2 table___element_2=1}
    Edit form 1, row 1:
    Code (Text):
    {fabrik view=form id=1 rowid=1}
    Show details view of form 1, row 1:
    Code (Text):
    {fabrik view=details id=1 rowid=1}

    Searching for form records to edit(top)

    Load form 1, and look for an existing record where the 'user' element has a value of 62. If the record is found, the record will be loaded for editing; if not found, a new record can be entered.
    Code (Text):
    {fabrik view=form id=1 usekey=user rowid=62}
    Load form 1 and look for an existing record where 'user=62 AND status=1'. You can add as many key/value pairs as long as you ensure that each value is separated by a pipe ( | ).
    Code (Text):
    {fabrik view=form id=1 usekey=user|status rowid=62|1}

    Embedding Lists(top)

    Embed a list with an ID of 1 into an article.
    Code (Text):
    {fabrik view=list id=1}
    Options:
    • random=1 - Starts showin the ordered records at a random start point (3,1 since 20/11/2013)
    • limit=5 limit the # of records shown (3,1 since 20/11/2013)
    • fabrik_show_nav=0 hides the list navigation
    • elements=732|734 - list of element ids to show separated by a '|' (3,1 since 20/02/2014)
    • list-picker=0 - hides the list picker (drop down which appears in admin to swap the list being viewed (3,1 since 20/02/2014)
    • hide-add=1 Hide the add button - overrides list's ACL settings, if set to 1. (3,1 since 20/02/2014)

    Filtering Lists(top)

    Filter a list to show only records where 'elementname' has a value of 'foobar'.
    Code (Text):
    {fabrik view=list id=1 tablename___elementname=foobar}
    Accessing URL parameters to filter a list:
    Code (Text):
    {fabrik view=list id=1 tablename___elementname=[param1]}
    [param1] is replaced with the value of param1 in the URL (e.g. URL ...option=com_content&view=article&id=11&param1=foobar)

    Reset applied filters (except prefilters):
    Code (Text):
    {fabrik view=list id=1 resetfilters=1}
    Hide the filters:
    Code (Text):
    {fabrik view=list id=1 showfilters=0}

    Filtering Lists - Advanced(top)

    Show rows where elementname1 is 'abc' AND elementname2 is one of 1, 4, 8, or 2:

    Code (Text):
    {fabrik view=list id=4 listname___elementname1=abc listname___elementname2[value]=1,4,8,2 listname___elementname2[condition]=IN}
    As you can see you may use almost any string as a condition value.

    Those strings have to be "url encoded". So any characters which aren't "legal" on a URL have to be replaced with their %xx equivalent. The most common example is a space (%20), but there are others like single or double quotes.

    You can generate urlencoded strings by using online tools like ...
    http://www.opinionatedgeek.com/dotnet/tools/urlencode/Encode.aspx

    Pay attention that when you use [condition] or similar (see below) for any field, you MUST use [value] for this field too.

    You may specify several values for one field using this syntax (may be necessary for some operations like BETWEEN, see example below):

    Code (Text):
    { ... listname___elementname[value][]=100 listname___elementname[value][]=200 ... }
    By default is equal condition is used for any value specified for row field. You may specify your own condition for each such field. List of possible conditions is :
    • <>
    • <
    • >
    IN(you need a comma-separated list of integers without surrounding quotes or parentheses as a value, see example above. I know nothing about list of text values but suppose each list item should be quoted)

    CONTAINS (you should specify a string as a value, and rows containing this string in specified field will be listed)

    BETWEEN - see example below

    By default all conditions specified joins with logical AND - they should match all together. If you want OR instead of AND - add this for all your conditions (may be except the first):

    Code (Text):
    { ... listname___elementname1[value][]=xxx listname___elementname2[value][]=yyy listname___elementname2[join]=OR}
    Theoretically you may combine AND and OR joins but I'll not explain it because of :
    • complexity
    • lack of use. AND always executes before OR and I know no 'operation parentheses' for Content plugin. So most likely the result of combining AND and OR will be not those you want.
    Ranged filters:
    Code (Text):
    { fabrik view=list id=4 listname___elementname[value][]=28/10/1999 listname___elementname[value][]=28/10/2000 listname___elementname[condition]=BETWEEN }
    NOTE that the date should be in the table view format, not as a mysql date format.

    To get the next 7 days worth of records :

    Code (Text):

    {fabrik view=list id=1 listname___date_time[value][]=now listname___date_time[value][]=%2B7+DAYS element_test___date_time[condition]=BETWEEN}
     
    The "%B7" is decoded to a '+' and the following '+' is decoded to a space, giving '+7 Days' as the top ranged filter value.

    Notice: the element name format listname___elementname_raw is not usable here although we use this kind of element name when filtering lists by database join or cascading dropdown element data. Use just listname___elementname instead, especially when we want display data dynamically using placeholder for a variable (e.g listname___elementname=[rowid]). In content plugin, it retrieves raw data for filter even when there are dbjoin or cdd elements while _raw could generate some problems.. See http://fabrikar.com/forums/showthread.php?t=22860 http://fabrikar.com/forums/showthread.php?t=22860


    Notice: Filters defiined inside {fabrik view=list......} are sticky and can not be unset by the user. As such they behave in a similar fashion to list prefilters


    Visualizations (top)

    Show visualization id 1
    Code (Text):
    {fabrik view=visualization id=1}
    resetfilters and showfilters can be used - see "Lists"

    Element data (top)

    Insert list 11 row 239's checkbox element's data
    Code (Text):
    {fabrik view=element list=11 rowid=239 element=element_test___checkbox}
    • repeatcounter=X- specify the repeat records value you want to use. Defaults to 0
    • repeatcounter=all - will render all the repeat group data, inside a <ul> (3.0 & 3.1 ince 09/10/2013)
    • If no rowid is specified then the first row is loaded (3.1 since 16/09/2013)
    • random=1 - loads a random record (3,1 since 20/11/2013)

    Accessing URL parameters(top)

    Code (Text):
    {fabrik view=list id=1 tablename___elementname=[param1]}
    [param1] is replaced with the value of param1 in the URL (e.g. URL ...option=com_content&view=article&id=11&param1=foobar)

    Common modifiers(top)

    Templating(top)

    For which ever view you choose, you can change its template by adding :
    Code (Text):
    layout=templatename

    Hide Form title(top)

    Code (Text):
    show-title=0
daydah, antonitus, ae2c2 and 2 others like this.