• 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.

How to get the rowid of an element to display in an article so the element value can be returned

b_e_scott

New Member
Hi,

Goal:

Be able to dynamically load a module position {loadposition REGION-<sevents_sched_vw___region_id>} inside an article which is based on the databasejoin value sevents_sched_vw___regionyear_id_raw.


Background:

I have a dynamic page that has 3 sections of data to be displayed for a given region (sevents_sched_vw___region_id). Section 1 consists of a Roksproket Module with tabbed Regional information (Region Overview, Event Alert and Event Fees) for the current value of the Fabrik element sevents_sched_vw___region_id. The idea here is to load the region specific Roksproket module by issuing the command {loadposition Region-<sevents_sched_vw___region_id>}. Since this is a dynamic page, I have a Roksproket Module created for each region id.

Section 2 is a Fabrik List of the Regional Director for a region which is based on the databasejoin Fabrik element (sevents_sched_vw___regionyear_id_raw). The code below calls this data without issues.

{fabrik view=list id=212 region_director_vw___regionyear_id={sevents_sched_vw___regionyear_id_raw} layout=bluesky}


Section 3 is a Fabrik List of Boating Events belonging to a region (sevents_sched_vw___region_id) scheduled on a specific day of a year.


Problem:

I need to be able to dynamically determine the Fabrik element value for sevents_sched_vw___region_id from the Fabrik List in Section 3 and use it to appended to the loadposition command to diplay Section 1.

The Fabrik List in section 3 has the following relevant Fabrik Elements:
sevents_sched_vw___Lake
sevents_sched_vw___event_date
sevents_sched_vw___region_id
sevents_sched_vw___Year
sevents_sched_vw___regionyear_id (databasejoin)

Question:

What is the best why to retrieve the value of element sevents_sched_vw___region_id so I can use that value to dynamically append to the loadposition command.

I've tried to use the command below to retrieve the value, but I don't know the rowid or know how to get it. Can you please provide the code to make this happen.

{fabrik view=element rowid=? element=sevents_sched_vw___region_id}




Thanks!
Bruce
 
The issue with trying to use the Fabrik content plugin to get the region_id is that the content plugins are run after modules are loaded. Where as what you need is something that is run before the module is loaded.

I think the simplest way to do this would be to clone your Joomla template, and add the addtional logic into the template to select which modules to load.

I wanted to give you some PHP explaining how to do that, However, I'm not clear on what the logic is behind what you are trying to do. Is the page a Fabrik component page or something else? What is the URL that is loading the page?
What is the relationship between region_id and regionyear_id?

In theory what you would do is either get region_id you need to filter by from the querystring, or use values in a querystring to build a query to get the region_id, then use that value in the J template index.php's

Code:
<jdoc:include type="modules" name="REGION-<?php echo $regionId?>" style="none" />
 
Hi Rob,

Thanks for the response. The page I'm trying to build is a based on the Fabrik List Component (section 2 and 3) with the exception of section 1 where I'm trying to use the Fabrik Element to append to the loadposition command.

Section 2 and 3 of this page is dynamically derived from a previous page (see attached file links.txt, I'm unable to enter links within this thread due to forum constraints) where the user selects the Season Year and click the View Schedules link for the region of interest (which is the databasejoin) . The goal is to display on a new page the Season Year schedule for that region (eg. see attached file links.txt, I'm unable to enter links due to forum constraints). The challenge now comes when my client wants to be able to dynamically provide information to his Anglers for each region (Region Overview, Event Alert, Entry Fees, etc). I decided to implement that requirement by calling the Roksproket Module for that region. This will allow my client to update the content of each Region Roksproket Module as needed to display the latest information about that region. As long as I'm loading the correct Region Roksproket Module, it will be consistent with the other regional content on the page.

region_id is the region number and regionyear_id (concatenation of region number and season year) is the season year that corresponds to that region. It's how I'm able to link the region to a specific season year in other related tables.

I'm open to our suggestions.


Thanks
Bruce
 

Attachments

  • Links.txt
    339 bytes · Views: 194
I don't have anything helpful to add, except that if you are trying to enter stuff like raw URL's that the forum messes with, you can just insert it as 'code', using the little {} code button in the editor.

Code:
The Initial page -> http://www.americanbass.co/index.php/en/tournaments/schedule-results
 
The Page I'm trying to create which is derived from the initial page  http://www.americanbass.co/index.php/en/southern-events-schedule/list/214?sevents_sched_vw___regionyear_id_raw=62011&limitstart214=0&resetfilters=1&fabrik_incsessionfilters=0)

-- hugh
 
Ok so I presume the last 4 characters in regionyear_id_raw is the year and the preceding characters are the region id? If so then this code in your cloned Joomla template will load the corresponding module:
PHP:
<?php
$app = JFactory::getApplication();
$regionYear = $app->input->get('sevents_sched_vw___regionyear_id_raw');
 
// Get just the region id (presumes the last 4 characters are the year)
$regionId= substr($regionYear, 0, -4);
?>
 
<jdoc:include type="modules" name="REGION-<?php echo $regionId?>" style="none" />
 
Thanks for the code! Will this show up on each page if I add it to the template? This logic is only applicable to one page on the website, not all. If it will show on each page, can you advise how to make it show up only on a specific page?
 
Either

* add a test for the page Itemid in the code,e.g. to show only on the page Itemid=9

PHP:
<?php
$app = JFactory::getApplication();
$itemId = $app->input->getInt('Itemid');
if ($itemId === 9) {
$regionYear = $app->input->get('sevents_sched_vw___regionyear_id_raw');
// Get just the region id (presumes the last 4 characters are the year)
$regionId= substr($regionYear, 0, -4);
?>
 
<jdoc:include type="modules" name="REGION-<?php echo $regionId?>" style="none" />
<?php }?>
*or clone your joomla template, add the proposed PHP to it, and assign the template to the menu item.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top