This topic is locked

Graphic / image on unfilled fields

10/24/2006 10:21:00 AM
PHPRunner General questions
G
gdude66 author

Hi,

Just wondering if I have a new entry added to a db and then it is looked up in a different table is it possible to have a graphic such as NEW appear for any new or unread entries?

If so how would you do this?

T
thesofa 10/24/2006

Hi,

Just wondering if I have a new entry added to a db and then it is looked up in a different table is it possible to have a graphic such as NEW appear for any new or unread entries?

If so how would you do this?



as a quick reply I would say you have to have a field for that record saying READ? with a default value of 0, then some code on the list page to say If READ?==0, highlight the entry in Australian Green, else, show it in British Racing Green?

Hope that helps point you in a direction???

Cheers

J
Jane 10/25/2006

Graeme,
you can do the following:

  1. add new field to the query on the EditSQL query tab.

    Here is a sample:
    select `field1` as `Newfield`,

    `field1`,

    `field2`,

    from `TableName`



Newfield is a column where your "new" image will appear.
2. add ViewOnLoad event on the Events tab.

Here as a sample code:

function ViewOnLoad()

{

global $where, $conn;

$str = "select field1 from TableName where ".$where;

$rs = db_query($str,$conn);

$data = db_fetch_numarray($rs);

$_SESSION["reads".$data[0]]++;

}



where TableName is your actual table name, FieldName is your actual field name where "new" image will appear.
3. select Custom on the "View as" settings dialog on the Visual Editor tab for Newfield field and add your code in it.

Here is a sample:

if ($_SESSION["reads".$value]<1)

$value = "<img src=\"include/new_image.gif\">";

else $value="";


4. put your new_image.gif to the include directory

G
gdude66 author 10/27/2006

Thanks Jane - Good work

S
sogoli 7/23/2009

not work with phprunner 5.0 & 5.1.

please help me

J
Jane 7/24/2009

Hi,
please clarify what doesn't work in the latest version.

S
sogoli 7/24/2009

Hi,

please clarify what doesn't work in the latest version.


i see not ViewOnLoad event on the Events tab with phprunner 5.0 and that is not work

J
Jane 7/27/2009

Hi,
use View page: Before process event for this purpose.