1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice
  2. If you update to Joomla 3.9.16, you will have to update Fabrik from the latest GitHub version, to fix a bug introduced in Joomla, which makes it impossible to list front end folder locations in backend JForms. This affects things like template selection.
    Dismiss Notice

Links on list1 (floating button) --> Edit: Edit list1, or Edit List2 - is possible?

Discussion in 'Standard Support' started by blue-mouse, Dec 2, 2015.

  1. blue-mouse

    blue-mouse Member

    Level: Community
    Hi,

    I need on my list1 to have 3 links --- in column with floating buttons --- :
    - Details view link for list1
    - Edit link for list1
    - Edit link for list2

    I use custom template for list1 and also custom template for list2 - this is the same template for both list1 and list2.

    list 1 and list 2 have the same records from table:
    ccjom_cc_kk_karta_rejestr___


    How to get one link more , this one:
    - Edit link for list2
     

    Attached Files:

  2. troester

    troester Well-Known Member Staff Member

    Level: Community
    If it has to be in the floating buttons you can add a php list plugin only redirecting to the edit link (+ hide all checkboxes).

    Or you can use one element with a custom link.
    Or you can do heavy string handling in your custom list template in default_row.php
     
  3. blue-mouse

    blue-mouse Member

    Level: Community
    But doesn't work {placeholder}.
    I have added php plugin to my list.
    Php code is:
    PHP:
    /* Redirect browser */
    header("Location: http://candc.katowice.pl/index.php/
    menu-karta-produkcji/adm-kp-mod-i-zatw-1/
    form/320/{ccjom_cc_kk_karta_rejestr___id}/"
    );
    /* Make sure that code below does not get executed when we redirect. */
    exit;
    In browser line i get:
    http://candc.katowice.pl/index.php/...w-1/form/320/{ccjom_cc_kk_karta_rejestr___id}

    I should get for example:
    http://candc.katowice.pl/index.php/menu-karta-produkcji/adm-kp-mod-i-zatw-1/form/320/51


    How to write code in php plugin to get this in my browser?
     
  4. troester

    troester Well-Known Member Staff Member

    Level: Community
    Not sure if this is the correct redirect code (where is this coming from)?
    But anyway
    I don't think a text inside "" will be interpreted as a placeholder.
    Try something like (I didn't test)
    Code (Text):
    /* Redirect browser */
    $loc = "Location: http://candc.katowice.pl/index.php/
    menu-karta-produkcji/adm-kp-mod-i-zatw-1/
    form/320/" . {ccjom_cc_kk_karta_rejestr___id} . "/";
    header($loc);
    /* Make sure that code below does not get executed when we redirect. */
    exit;
     
  5. blue-mouse

    blue-mouse Member

    Level: Community
    Not works.
    Nothing similar to this code.
     
  6. troester

    troester Well-Known Member Staff Member

    Level: Community
    Where are you doing this?
    In the php code field directly in the php plugin?
    Or in a php script file (your can't use placeholders there)?
     
  7. blue-mouse

    blue-mouse Member

    Level: Community
    In the php code field directly in the php plugin.

    I try different possibilities : like your sample of code and like my sample of code.
    Nothing not works.

    I could use inline button also - this is not important.
    But i need 3 links
    details/view list1
    edit list1
    edit list2
     

    Attached Files:

    Last edited: Dec 3, 2015
  8. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    The list PHP plugin doesn't do anything with placeholders, as no "form data" is submitted to list plugins, you just get the id's of the selected rows being processed. If you need data, you have to look it up yourself. If you look at another example of a plugin, like update_col, you can see how it does that:

    Code (Text):

            $ids = array_unique($input->get('ids', array(), 'array'));
            JArrayHelper::toInteger($ids);
            $this->row_count = count($ids);
            $ids = implode(',', $ids);
            $model->reset();
            $model->setPluginQueryWhere('update_col', $item->db_primary_key . ' IN ( ' . $ids . ')');
            $data = $model->getData();
     
    ... although that won't work exactly as is, it needs some other variables set up in the lines prior to that.

    But that's an extremely heavy weight way of doing it, and doesn't work if someone selects more that one row.

    I think your best bet is to do this in your template. In default_row.php you could add an action to $this->_row->fabrik_actions, something like ...

    Code (Text):

    $myAction = '... some markup ... href="http://candc.katowice.pl/index.php/menu-karta-produkcji/adm-kp-mod-i-zatw-1/form/320/' . $this->_row->data->ccjom_cc_kk_karta_rejestr___id . '" ... more markup ...';
    str_replace('</div>', $myAction . '</div>', $this->_row->data->fabrik_actions);
     
    I can't give you the exact markup, as I don't have a 3.0 server to hand at the moment, and I don't know which method you are using for showing your links. But what you are aiming to do is build another link using the same markup as the others (add, edit), and insert it into the <div> used by the actions.

    -- hugh
     

Share This Page