• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

element data and content plugin

joit

Active Member
Is it only possible to fill an element in a content plugin using the rowid?
I have a hard time to find the rowid out.

I want to pass a parameter with an URL to the element content plugin and using a value of another element (as with lists) would be so much easier but it doesn't work.

Is there another way?

Thanks
 
For a form you can use
usekey=your-other-element rowid=value-of-your-other-element

I don't know if this is doing for elements, too.
 
ok, I actually try to get the value of the joined userdetails list but for testing I used this to display a username:
{fabrik view=element list=2 usekey=username rowid=[abc] element=xyz_users___username}
but it doesn't matter what value I pass with "abc", it doesn't work (alwaays the same wrong value is displayed)
 
hmmm, I tried to open an element for editing and while this works:
{fabrik view=form id=1}

this just displays an empty article:
{fabrik view=form id=1 usekey=vendor_id rowid=14}

So, rowid should in this case really not be the rowid but instead the value that is inside the vendor field of the row I want?
 
Last edited:
Yes, that's what "usekey" is for.
If you have an element with non-unique values it will take the first record (I think).
I want to pass a parameter with an URL to the element content plugin and using a value of another element
I thought this is what you were looking for?
 
yes, exactly!
but I just can't get it to work...
tried with protostar, checked access rights.
 
this just displays an empty article:
{fabrik view=form id=1 usekey=vendor_id rowid=14}
Is vendor_id the correct element name and do you have a record with vendor_id=14?
Make sure you don't have any HTML formatting inside {} (switch the editor to source code view).

Which article is it?
 
Vendor with id 14 is correct
I checked the formatting, it should be ok.

this is the "source" for the element details (custom link on element "K?che")
161121/vendors
this is the "Target" for the element details
161121/component/content/article?id=18&wirt=14
(correct shop name should be visible in header)

this is the page for the form's elemend to be filled out
161121/component/content/article?id=19
(must be logged in with vendor14/vendor14 here 161121/anmelden)
 
Last edited:
I have no idea if usekey would work with view=element, probably not.

What I always do in this situation with the content plugin, when I want to pass something other than the rowid in on the query string, whether I'm displaying a form or an element, is rather than using usekey (which has some potential gotchas), I just look up the rowid by hand with a few lines of code using Sourcerer ...

Code:
{source}
<?php
$myKey = JFactory::getApplication()->input->getCmd('foo', '');
$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery->select('id')->from('mytable')->where('whatever = ' . $myDb->quote($myKey));
$myDb->setQuery($myQuery);
$myRowid = $myDb->loadResult();
if (!empty($myRowid)) {
   echo "{fabrik view=element list=X element=mytable__something rowid=$myRowid}";
}
else {
   echo "Record for $myKey not found";
}
?>
{/source}

... which would take &foo=xyz, look up the row with field 'whatever' = xyz, and get the actual 'id' for that, then just use that as the normal rowid.

Note I'm using getCmd() for the input, as that's one of the safer input sanitizing options, bearing in mind we're using the input in a query. We're quoting it in the query, but when using user inputs in queries, be as safe as you can be. If the 'cmd' filter doesn't work for you, pick one from ...

https://docs.joomla.org/Retrieving_request_data_using_JInput

-- hugh
 
ok, thanks!
I installed sourcerer but where should I place the code?
in the "source" or in the "target"? I'm using a custom link in the "source"
 
As you can see, the code outputs the {fabrik view=element ...} plugin incantation. So it goes in the article where you want to show that, using the query string arg to select which rowid to show.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top