Você está na página 1de 5

2/9/2016

Creating a custom list template | Fabrik

Login

Home

Forums

Main_Page

Wiki
Special:

Members

PageList

Home Wiki Lists HowdoI...ListsAdvanced

Creatingacustomlisttemplate
Page
Creatingacustomlisttemplate

Contents
Location
CustomCSSinexistinglisttemplates
Copyinganexistingtemplate
Creatingacataloglikelistview(divtemplate)
Templateoverallstructure
default.php
default_row.php
default_filter.php
default_headings.php
default_buttons.php
template_css.php
javascript.js
LayoutOverridesListrowbuttons
Exampledon'tshoweditbutton

Location (top)
Listtemplatesarelocatedin"/components/com_fabrik/views/list/tmpl/".Eachtemplatehasitsownfolder.

CustomCSSinexistinglisttemplates

(top)

http://fabrikar.com/forums/index.php?wiki/customstylingalist/

Copyinganexistingtemplate (top)
Tocreateanewtemplatewesuggestthatyoucopyanexistingtemplatefolderandalterittosuityourneeds.
Copy:
components/com_fabrik /views/list/tmpl/bootstrap/
to:
components/com_fabrik /views/list/tmpl/mytemplate/
ThetemplateusedforalistisnormallysetinList/Details/Layout/FrontEndorAdminTemplate,however
thiscanbeoverriddeninthemenuitemthatlinkstotheListinwhichcaseyouwillneedtoedittheMenu
http://fabrikar.com/forums/index.php?wiki/creating-a-custom-list-template/

1/7

2/9/2016

Creating a custom list template | Fabrik

instead.
Creatingacataloglikelistview(divtemplate)

(top)

Useacopyofthe"div"template(don'tmodifythedivtemplateitself,itwillbeoverriddenwiththenextupdate).
Indefault.phpyoucansetthesegeneralparameters
Code(Text):

//Thenumberofcolumnstosplitthelistrowsinto
$columns=1
//Showthelabelsnexttothedata:
$this>showLabels=true
//Showemptydata
$this>showEmpty=false
Indefault_row.phpsingleelement'slabelanddatacanbeaddressedvia
Code(Text):

$elementLabel=$this>groups>tablename___elementname//replace'tablename___elementn
$elementData=$this>_row>data>tablename___elementname

Templateoverallstructure (top)
default.php

(top)

PHP:

http://fabrikar.com/forums/index.php?wiki/creating-a-custom-list-template/

2/7

2/9/2016

Creating a custom list template | Fabrik

<?php}?>
<divclass="fabrik_groupdata">
<divclass="groupdataMsg">
<divclass="emptyDataMessage"style="<?phpecho$this>emptyStyle
<?phpecho$this>emptyDataMessage?>
</div>
</div>
</div>
<?php
foreach($groupas$this>_row){
echo$this>loadTemplate('row')
}
?>
<?phpif($this>hasCalculations){?>
<ulclass="fabrik_calculations">
<?php
foreach($this>calculationsas$cal){
echo"<liclass=\"fabrik_row___".$el."\">"
echoarray_key_exists($groupedby,$cal>grouped)?
echo"</li>"
}
?>
</ul>
<?php}
$gCounter++
}?>
</div>
<?php
echo$this>nav
print_r($this>hiddenFields)
?>
</div>
default_row.php

(top)

default_row.phpiscalledrepeatedlytorenderallofyourlistsrows.
Toaccessaspecificelementyoucando:
PHP:

$this>_row>data>tablename___elementname//replace'tablename___elementname'withyou
<?phpecho$this>_row>data>tablename___element_name?>

Eachrowhasastandardsetofproperties:
PHP:

http://fabrikar.com/forums/index.php?wiki/creating-a-custom-list-template/

3/7

2/9/2016

Creating a custom list template | Fabrik

stdClassObject(
[data]=>stdClassObject(
[slug]=>64
[__pk_val]=>64
[fabrik_select]=>
[fabrik_view_url]=>/fabrik30x/index.php?option=com_fabrik&view=details
[fabrik_edit_url]=>/fabrik30x/index.php?option=com_fabrik&view=form&Itemid
[fabrik_view]=>[Viewlinkandicon]
[fabrik_edit]=>[Editlinkandicon]
[fabrik_actions]=><ul>oftheapplicationrowbuttonsedit/view/delete
)
[cursor]=>1
[total]=>16
[id]=>list_37_com_fabrik_37_row_64
[class]=>fabrik_rowoddRow0
)

Relateddatalinksareinthisformat:
PHP:

<?phpecho$this>_row>data>{'##1___##2##3##4_list_heading'}?>

Noteadefault_row.phpfileisobligatoryifyouwantajaxliststoworkcorrectly
default_filter.php

(top)

Willrenderanyfiltersyouhave.
Anexamplecustomdefault_filter.phptemplatetorenderthesearchfieldshorizontally
default_headings.php

(top)

Rendersthelistsheadings.
default_buttons.php

(top)

Rendersthelistsbuttons,suchas'add','exporttocsv','importfromcsv'
template_css.php

(top)

Thisisusedtoserveacssfilewhosecssisspecfictothelistbeingrendered.
javascript.js

(top)

ContainsanytemplatespecificJavaScriptyoumaywishtouse.

LayoutOverridesListrowbuttons

(top)

Youcanoverridethemarkupthatisusedtogeneratethelist'srowsbuttons(edit/delete/viewetc).
List'shavetwostylesforrenderingtheirrowbuttons,thesearedefinedbythelists''links>renderbuttonsas'.
Youcanchooseeithertorenderasadropdownorinline.
Eachbuttonandeach'renderbuttonsas'optionhasacorrespondinglayoutfile,e.g.fabrikdeletebutton.php,
http://fabrikar.com/forums/index.php?wiki/creating-a-custom-list-template/

4/7

2/9/2016

Creating a custom list template | Fabrik

inline.phpanddropdown.php,foundincomponents/com_fabrik/layouts/listactions/
YoucancopythislayoutsfolderandtherequiredlayoutfiletoyourJoomlatemplatefolder'soverridesfolder,
e.g../templates/your_template/html/layouts/com_fabrik/listactions/dropdown.php,andthisdropdownlayoutfile
willbeusedtorenderthebuttons.
Exampledon'tshoweditbutton

(top)

PHP:

<?php
/**
*Layout:listrowbuttonsrenderedasaBootstrapdropdown
*
*@packageJoomla
*@subpackageFabrik
*@copyrightCopyright(C)20052013fabrikar.comAllrightsreserved.
*@licenseGNU/GPLhttp://www.gnu.org/copyleft/gpl.html
*@since3.0
*/
//Nodirectaccess
defined('_JEXEC')ordie('Restrictedaccess')
$class='btngroupfabrik_action'
if($displayData['align']=='right')
{
$class.='pullright'
}
?>
<divclass="<?phpecho$class?>">
<aclass="dropdowntogglebtnbtnmini"datatoggle="dropdown"href="#">
<spanclass="caret"></span>
</a>
<ulclass="dropdownmenu">
<?phpforeach($displayData['items']as$key=>$val)
{
if($key!=='fabrik_edit')
{
echo"<li>".$val.'</li>'
LastModified:Dec14,2015at9:14PM(Cached)

(Like)(15931View s)

XenCartaPROJasonAxelrodfrom8WAYRUN.COM

Login
UsefulLinks
CreateaFabrikAccount
FabrikWiki
http://fabrikar.com/forums/index.php?wiki/creating-a-custom-list-template/

5/7

Você também pode gostar