This topic is locked

list page

7/13/2006 8:18:19 AM
PHPRunner General questions
adamdidthis author

Hi I have a table called orderform that contains a field called deleted. I have a script that sets deleted to 1 if I wish to delete an order. I don't want the record to be deleted from the database I just want it to be displayed differently to the rest of them.
So is it possible to put in an if statement that looks at the deleted field and if it contains a 1 to make the links next to the record disappear and the text for that record appear in red?

J
Jane 7/13/2006

Hi,
you can do it to modify generated files manually.

Open ..._list.php file, locate loopRs function and replace following code snippet:

if(""!=FORMAT_HTML && ""!=FORMAT_FILE_IMAGE)

echo ProcessLargeText(GetData($rsData,$data,"FieldName", ""),$iquery);



with this one:

if(""!=FORMAT_HTML && ""!=FORMAT_FILE_IMAGE)

if (ProcessLargeText(GetData($rsData,$data,"deleted", ""),$iquery)==1)

{?><font color=#cc0000><?php

echo ProcessLargeText(GetData($rsData,$data,"FieldName", ""),$iquery);

?></font><?php

}

elseecho ProcessLargeText(GetData($rsData,$data,"FieldName", ""),$iquery);



where FieldName is your actual field name.
Make the same for all fields on the List page.

adamdidthis author 7/13/2006

Thanks for that it changed the colour of the text, but is there anyway of stopping the links for edit, copy etc from appearing?

D
drh 7/13/2006

Thanks for that it changed the colour of the text, but is there anyway of stopping the links for edit, copy etc from appearing?



You bet you can. This is how I did it to display the edit link only if I allowed the record to be editted per field.
Look for this line in _list.php
if((CheckSecurity($strOwnerID, "Edit")) ......
Change it to:

if((CheckSecurity($strOwnerID, "Edit")) && ($data["deleted"] != '1')) ...... then display the edit link
I think my parans are correct.
Dave