Loading...
 
Skip to main content

Features / Usability


Variables in Pretty Tracker

Hello Everyone

I have been using TikiWiki (Version 3.3) for about a month and really appreciate the amount of work put into the project. At this point I am trying to master trackers. Who isn't, as I can see from other posts. Here is my scenario.

I would like to build a directory of Banks based on two trackers:

Tracker=Bank, Tracker Id=10

Id
Name
Type
Options
55
Bank Name
text field
56
Description
textarea


Tracker=Branch, Tracker Id=11

Id
Name
Type
Options
57
Branch Name
text field
58
Bank Name
item link
10,55,0,
59
Description
textarea

I populated the two trackers with data...

Id=10

Bank Name Description
Bank Of America Just a Bank.
Citibank Just Another Bank.


Id=11

Branch Name Bank Name Description
West Bank Of America Free coffee.
East Bank Of America Nice view.
North Citibank Ample parking.
South Citibank Extended hours.


Now I would like to create a page where I can see a bank data from the two trackers. So I created a branch tracker template:

Wiki Page = display branch tracker tpl
Copy to clipboard
Branch Name: {$f_57} Branch Description: {$f_59}


I created a bank tracker template:

Wiki Page = display bank tracker tpl
Copy to clipboard
Bank Name: {$f_55} Bank Description: {$_56} In our city the bank has the following branches: {TRACKERLIST(trackerId="11",max="-1",filterfield=58,exactvalue={$f_55},wiki="display branch tracker tpl")} {TRACKERLIST}


Naturally, since it is a template, and I would like to recycle it for other things, I do not want to hard code the bank name in it. So instead of exactvalue="Citibank" for example, I put exactvalue={$f_55}

Now I create the top view page.

Wiki Page = Bank View
Copy to clipboard
{TRACKERLIST(trackerId="10",max="-1",filterfield="55",exactvalue= "Citibank",wiki="display bank tracker tpl")} {TRACKERLIST}

The result is:

tiki-index.php?page=Bank+View
Copy to clipboard
Bank Name: Citibank Bank Description: Just Another Bank. In our city the bank has the following branches:


So based on this, plus on the explanation provided below by ibrrorg I conclude that it is not the way it should be done in TikiWiki.

My workaround:

1. Create the following .ccs file and place it in /styles directory.

CollapseBreaks.css
Copy to clipboard
/* Remove breaks */ .collapse_br { display:none;} /* end of file */


2. Update bank tracker template.

Wiki Page = display bank tracker tpl
Copy to clipboard
{HTML()}{HTML} Bank Name: {$f_55} Bank Description: {$_56} In our city the bank has the following branches: {HTML()}{HTML}{TRACKERLIST(trackerId="11",max="-1",wiki="display branch tracker tpl")} {TRACKERLIST}{HTML()}{HTML}


3. Update branch tacker template.

Wiki Page = display branch tracker tpl
Copy to clipboard
{HTML()}{HTML}{if $f_58 eq $f_55} Branch Name: {$f_57} Branch Description: {$f_59} {else}{/if}{HTML()}{HTML}


4. Get Results.

tiki-index.php?page=Bank+View
Copy to clipboard
Bank Name: Citibank Bank Description: Just Another Bank. In our city the bank has the following branches: Branch Name: North Branch Description: Ample parking. Branch Name: South Branch Description: Extended hours.


Sorry folks all data between HTML tags is removed by this forum software. So you will not be able to see what I put there 😑

test

This error stuff is madness (can't edit your own posts)! So, I'm on a phone and will post back later a complete example for you. You REALLY need to consider upgrading to Tiki 4.x as it simplifies stuff and my response will be from Tiki 4.0

The Full
Copy to clipboard
{TRACKER(trackerId="4" fields="42:44:45:46:47:48:49:50:51:52:53:54" action="Enter Yard" showmandatory="y" view="page")}Yard Info Entered!{TRACKER} {TRACKERFILTER(trackerId=4,filters=42/t:44/t:45/t:46/t, fields=44:45:46 action="Search Yards" showlinks="y")}This is the result{TRACKERFILTER} {trackerlist trackerId="4" fields="44:45:46" sort="y" showlinks="y" sort_mode="created_desc" max="5" showpagination="y"} }

Data
Copy to clipboard
{TRACKERLIST(trackerId=4, view=page, max=-1, wiki=Yard Info Data Template)}{TRACKERLIST} }

Page
Copy to clipboard
{TRACKERLIST(trackerId=4, view=page, max=-1, wiki=Yard Info Data Template)}{TRACKERLIST} }


So, in a nutshell the first deal takes a page and creates the option to enter, search, edit and list all trackers. The rest of it is actually the guts of it. Luci coded this up and then I refined the parameters.