-
"Fabrik 4" helpers needed!Dismiss Notice
You are invited to join other community members active in coding, maintaining and improving Fabrik. Please visit https://fabrik.help for more information!
Content plugin
-
The Fabrik content plug-in allows you to embed Fabrik content within your Joomla articles
Contents
Embedding Forms(top)
Add a new record into a form whose ID is 1:
Code (Text):{fabrik view=form id=1}
Code (Text):{fabrik view=form id=1 table___element_1=2 table___element_2=1}
Code (Text):{fabrik view=form id=1 rowid=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}
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}
- 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)
Ordering Lists(top)
- orderby=tablename___elementname
- orderdir=desc
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}
Code (Text):{fabrik view=list id=1 tablename___elementname=[param1]}
Reset applied filters (except prefilters):
Code (Text):{fabrik view=list id=1 resetfilters=1}
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}
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 ... }
- <>
- <
- >
- <> for <>
- < for <
- > for >
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}
- 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.
Code (Text):{ fabrik view=list id=4 listname___elementname[value][]=28/10/1999 listname___elementname[value][]=28/10/2000 listname___elementname[condition]=BETWEEN }
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][]=now%2B7+DAYS listname___date_time[condition]=BETWEEN}
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}
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]}
Common modifiers(top)
Templating(top)
For which ever view you choose, you can change its template by adding :
Code (Text):layout=templatenameHide Form title(top)
Code (Text):show-title=0Item ID(top)
If you want URL's within the list / form to be routed with a different menu item than the one the plugin is being displayed on, add itemId=X
Code (Text):itemId=123
XenCarta PRO
© Jason Axelrod from 8WAYRUN.COM