This topic is locked
[SOLVED]

 Variable scope - Code Snippet in Listpage Field

8/16/2019 5:26:01 PM
PHPRunner General questions
C
ckranich authorDevClub member

Hi,
I am struggling with displaying a gif image depending of a (text) field value.

  1. I found that I can echo HTML code in a snippet (inserted in Page Editor into this field)

    like

echo '<IMG alt="OFFLINE" src="images/offline.gif" border=0>';


2) also in "BeforeProcessRowList" Event I can access/manipulate field contents using $data["your_field_name"]

however if I replace field content here, it is output as text (and not as HTML as under 1) )
? How can I access/(manipulate) field information in snippet . I tried using GetMasterRecord() to get a reference to $data,

but it did not work
Any suggestions?
Thx

Sergey Kornilov admin 8/16/2019

If you need to output HTML set 'View as' type of that field to HTML and use BeforeProcessRowList to populate it.
Code snippets are executed once per page and not very useful on the List page that displays multiple rows. However, on pages like Edit and View you can use getCurrentRecord() function to access current record data:

https://xlinesoft.com/phprunner/docs/getcurrentrecord.htm

C
ckranich authorDevClub member 8/17/2019

Great!

Many Thanks, that did it.
The first part I had already, but I was missing the "View as HTML" to have it output on HTML layer.
Maybee, some time I will stop asking noob-questions....
Kind Greetings,

ckranich