4 Replies Latest reply on Sep 2, 2010 4:20 PM by Polarpro

    Using HTML for displaying records

    Polarpro

      Title

      Using HTML for displaying records

      Post

      Hey there,

      For a long time I've been using happily the webviewer to display my records in browse mode. As my records contain many empty fields I use a calculation field, and the result is an HTML table that then is shown in the webviewer and that shows only the fields that have a value, plus a few nice horizontal lines in-between  :-)

      I am now in the process of setting up a solution for an Intranet, using PHP and the PHP Site Assistant (PHPSA). I am actually quite content with the result, except one thing. Instead of telling PHPSA to display a bunch of fields (most of them being empty), I thought it is easiest to simply use my calculation field for display and simply pass on some HTML code. On my PHP website the contents of my calculation field are being displayed; however, the Greater-than and Lower-than signs are shown as > and <, instead of being recognized as HTML signs. I looked up the source code and saw that > and < were translated to &gt; and &lt;

      So, my question is: What can I do to tell the browser / my PHP sites, that I don't want my text to be translated into HTML code (as I need the real > and < for displaying tags)? I've tried to delete several methods, but couldn't find what actually caused this unwanted translation. The attached screenshot might be helpful.

      Thanks a lot...

      Mike


      Screenshot.png

        • 1. Re: Using HTML for displaying records
          Mystick

          You must close the PHP part of your code, insert the html part, and restart the php...

          php code... ?>
          html
          <? ... php....

          • 2. Re: Using HTML for displaying records
            Polarpro

            Hey,

            Thank you for your answer. I tried it, but didn't get it working. After all, this PHP part is there to get the contents of a field ('Intra_Voll'); so, I think I cannot really "close" this part. Or am I wrong?

            Here is a part of the code; I think the last appearance of Intra_Voll is the one that is relevant:

            <tr class="field">
                <td class="field_name">
                    <?php echo Intra_Voll str_replace(' ', '  ',htmlentities('Intra_Voll',ENT_NOQUOTES,'UTF-8',false));?>
                </td>
                <td class="field_data">
                    <?php echo nl2br(str_replace(' ', '  ', storeFieldNames('Intra_Voll', 0, $record, false, 'EDITTEXT', 'text')))?>
                </td>
            </tr>

            • 3. Re: Using HTML for displaying records
              Mystick

              Did you try to put the closing/opening php tag inside the html code of your field ?

              so your Intra_Voll field would begin with ?> and finish with <?

              So you don't change your php code, just the contain of your intra_voll field...

              • 4. Re: Using HTML for displaying records
                Polarpro

                Hey Mystick,

                Thank you for your suggestion and sorry for the late reply.

                I tried it, but somehow I did not manage to get it working.

                However, I tried something different that seems to work. I place html_entity_decode before the field that i want to show, e.g.

                <td class="field_data"><?php echo html_entity_decode(storeFieldNames('Intra_Voll', 0, $record, false, 'EDITTEXT', 'text'));?></td>