Hi Vladimir,
I'll walk you through it, in detail - I'm sure this will be useful to others too. The new wiki has a lot of good info but it's a work in progress.
For anyone stumbling on this in the forum, these steps outline, step by step how to:
CREATE A DROPDOWN IN A MODULE TO DISPLAY A JOOMLA ARTICLE POPULATED BY THE SELECTED DATABASE RECORD
1. Create a small single purpose Form in Fabrik. Fabrik->Forms Choose New (Orange Plus icon). Name and save it. This should create a Form, Group and 2 elements. (Note: this will not create a table for the form and so will not store each submission of this form. To do that, create a Table instead of a Form, the Table will create the form for you.)
2. You need to add 1 more element of Plug-in type=databasejoin.
For the element: Render Join as Dropdown.
Under the Heading Data, Table=[choose the table you want to display],
Value[choose an element from the table, usually id, but you need a unique identifier for the record you will select in the dropdown],
Label=[choose the element you want that is human friendly to select the desired record],
Or Concat label=[If you need to give more info in Label to select, if say you have users occurring more than once at multiple venues, then you will want to have a Label that displays the Username & Venue.
As an example, you might enter:
Code:
{thistable}.mbr_name,' - ',{thistable}.venue
Joins where and/or order by statement (SQL) is a simple sql where statement like:
Code:
WHERE {thistable}.active_status = '1' ORDER BY {thistable}.venue DESC
This statement would only show records with an active status of 1 and the dropdown would display in groups by venue and descending.
Generally, you can leave the rest of the settings as they are - read the Label tips and experiment if needed to see how they work.
3. In your Joomla Extensions, Module Manager you will find a Module called Fabrik Form Module. Open this and in the Advanced options on the right, Choose your newly created form. Set Row id=0. Choose a Form Template from the list - start with default. I don't think Ajaxify will matter here, but let's say Yes. In the Menu, Assignment section, select the menu item(s) you want this form to display on. Depending on your Template, you'll need to choose a Position for your form to display - select a position and visit the page you've assigned to see that it is appearing and is in the location you want. (Make sure the Module is enabled)
4. Next you need to create a redirect plugin, go to Fabrik->Forms and select your newly created form. Choose the Plug-ins Tab and press Add. --do--=redirect, in=Front end, On=New. Under Jump page, enter the link you want. That is, go to the Article page you want and copy from the URL but leave off the domain name like:
Code:
/myarticlepageurl
//Whatever the URL of the page you want to land on is, enter it here
With the Append jump url with data=yes. Under Module/content plug-in redirect options set Conent Reset=Yes, Content Redirect=Same Page. leave the rest blank.
Alternatively, choose no for Append jump url with data, and you can try to set the appended data yourself in the Jump Page box with something like:
Code:
/myarticlepageurl?venueforuser={___mydbasejoinelementname_raw}
//Adding _raw will fills in the unique id, leaving off _raw fills in the Label
This way, you can make the label whatever you want instead of what Fabrik generates.
5. Test the form on your article page. If it's working it should reload the page with ?venueforuser=x or it will use your elementname and the value after the ? (or if appended data already exists you may need or it will use & instead of the ? to append in the URL.
6. Install Sourcerer from NoNumber. Go to Joomla's Extensions->Plug-ins in the filter box, type sourcerer.Open the Sourcerer Plugin and set Basic Options to a unique tag like mysourcerertag. Leave the rest of the options alone.
7. In your article you will input your article like this:
Code:
OPTION 1:
${mysourcerertag}<?php $query = "SELECT exactelementname FROM exacttablename WHERE id = $_GET['venueforuser']";$database->setQuery($query);$result = $database->loadResult();echo $result;?>{/mysourcerertag} Monthly Membership including 1 Free Trial Month. First Payment one month AFTER Activation via Paypal:
This seems a bit complicated but it's really just cut and paste: You only need to set the exactelementname, exacttablename, and venueforuser parts of this. These three pieces select the column, table and record respectively, letting you pull any value you want from the database. The code parts are just telling PHP and MySql what you want and what to do with it (echo which will display it for you.)
Note: In this case, the $_GET['venueforuser'] bit of code is pulling the value supplied in the URL ie. /featured-vehicles?venueforuser={___mydbasejoinelementname_raw} will become /featured-vehicles?venueforuser=x and the $_GET command will pull the x value.
Each time you select a new record from the dropdown, a new x value will show in the URL and this will cause the php code to pull the values for elements in the new record.
This is a long bit of text because I've explained nearly every step required. Just follow the steps and this should work nicely.
If it's not working - re-read the steps closely. You may have missed something.
(Note that I haven't done this myself - I'm just writing out the steps I would take. I may have missed something.)
Good Luck,
-J