1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

Link to form in Joomla Article

Discussion in 'Community' started by venekamp, Jun 2, 2019.

  1. venekamp

    venekamp New Member

    Level: Community
    Hi,

    I am working on a project with lot of joomla articles. In the articles I need specific terms that in general are explained in footnotes. I created a table "Footnotes" with Id, Footnote, Description. Using this table should enable me to re-use my footnotes in many different articles.
    But how can I create a link that shows the specific record (like in wiki-pedia). Reading the documentation I get more and more confused.
    Please give me a direction.

    Klaas
     
  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    To display a specific record in details (read only) view ...

    {fabrik view=details formid=123 rowid=234}

    Replace 123 with the numeric form ID (the number on the left in the main list of forms in the Fabrik backend), and 234 with the row ID of the record you want to display.

    -- hugh
     
  3. venekamp

    venekamp New Member

    Level: Community
    Cheesegrits thanks, but this is not what I want. This shows my footnote within the article.
    My searching was to complex.
    I just figured out that --<a href="index.php?option=com_fabrik&amp;view=details&amp;formid=164&amp;rowid=1" target="_Footnote">Text<sup>note</sup></a> -- shows the footnote in a new window.
    I would like to show the footnote in a form module once the link is clicked. The form module however shows no content or only footnote number 1 depending on the parameter Row_id set in the module definition when the article is loaded. Clicking the link opens a new window.
    Regards
    Klaas
     
  4. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Hmmm. Showing footnotes in a module would be tricky, as (as you discovered) there's no easy way to relate your article ID for the page to the footnote (Fabrik form row ID) you want to show. The only way to do that I can think of would be to have a little custom code in a custom module, and a lookup table (called, say, article_footnote_map, with id, article_id and row_id) which defines which footnote row you want to show for which J! article ID. THen you could look the row ID up from the article ID in the query string, and load the details view for that ...

    Code (Text):

    $db = JFactory::getDbo();
    $query = $db->getQuery(true);
    // get the &id=X from the query string for the J! article ID
    $articleId = JFactory::getApplication()->input->getInt('id', 0);

    if (!empty($articleId)) {
       // look up which footnote row ID we want from our lookup table
       $query->select('row_id')->from('article_footnote_map')->where('article_id = ' . (int)$articleId);
       $db->setQuery($query);
       $rowId = $db->loadResult();
       if (!empty($rowId)) {
          // render a fabrik plugin string
          echo "{fabrik view=details formid=123 rowid=" . $rowId . "}";
       }
    }
     
    -- hugh
     
  5. venekamp

    venekamp New Member

    Level: Community
    Hugh,
    Thanks for the solution. I just want to use as little code as possible.
    I just found an other solution to solve my problem with the footnotes. I replaced the idea for a module with the idea for a pop-up.
    I found a Joomla plugin that shows pop-ups. I replaced the html link in the plugin with the standard form syntax used in fabric "index.php?option=com_fabrik&amp;view=details&amp;formid=164&amp;rowid=2"
    This works fine for me, is simple and very flexible and teh foornotes are even independent from the articles.
    Regards Klaas
     

Share This Page