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

Change color to a value

Discussion in 'Community' started by nobilebarabba, Jun 26, 2020.

  1. nobilebarabba

    nobilebarabba New Member

    Level: Community
    I would like to color a field by value in the list view.
    For example if I have a text value equal to "OK" the text should be green.
    can someone help me?
    Thank you
     
  2. dimoss

    dimoss Well-Known Member

    Level: Community
  3. nobilebarabba

    nobilebarabba New Member

    Level: Community
    This code seem works but it takes the first value and repeat the same in every row

    <?php
    $myElement = (int)'{manutenzioni_programmate_37_repeat___eseguito_raw}';
    if ($myElement == 'OK') {
    echo '<font color="green">OK</font>';
    }
    else if ($myElement == 'KO') {
    echo '<font color="red">KO</font>';
    }
    ?>
     

    Attached Files:

    Last edited: Jun 27, 2020
  4. dimoss

    dimoss Well-Known Member

    Level: Community
    If the value is text why you cast it as an integer?
    Also you have an if...else if structure. What if teh value is not 'OK' nor 'KO'?
    Or are there only two possibilities?
     
  5. nobilebarabba

    nobilebarabba New Member

    Level: Community
    The value is a text and I have only two possibilities

    What I need is a custom list with some field highlighted
     
  6. lousyfool

    lousyfool Active Member

    Level: Community
  7. nobilebarabba

    nobilebarabba New Member

    Level: Community
    a single element should change color based on its value...
    then I'd like to customize the list and the pdf that is generated

    can U help me?


    sorry but I'm not very expert in this component but it seems to me very powerful
     
    Last edited: Jun 29, 2020
  8. nobilebarabba

    nobilebarabba New Member

    Level: Community
    I managed to create a customized template as a detail but the generated pdf does not look like the detail itself.
    How can I create a customized template for pdf too? I read the instructions but I don't know how to recall the various elements.

    Thank you
     
  9. troester

    troester Well-Known Member Staff Member

    Level: Community
  10. nobilebarabba

    nobilebarabba New Member

    Level: Community
    I sow but how can I create PDF template with (only) name | city | note for example?
    default.php file returns all elements

    $this->elements = $group->elements;
    echo $this->loadTemplate($group->tmpl);

    ???
     
  11. troester

    troester Well-Known Member Staff Member

    Level: Community
  12. nobilebarabba

    nobilebarabba New Member

    Level: Community
    thank you!

    now I have my custom details (see attachment) but the pdf generated look without stylesheet (second attachment)
    PDF library is DOMPDF
    J 3.9.19
    PHP 5.6
    Fabrik 3.9
    installed in a local machine (XAMPP)

    with debug PDF enable, it create a new page as you can see in the attachment but not a PDF as a new file
     

    Attached Files:

    Last edited: Jul 1, 2020

Share This Page