This topic is locked

Hide empty fields

1/28/2008 2:11:04 PM
PHPRunner General questions
M
mmponline author

I need a field not to show when it is empty on the list and details page.
I can't find it but is sure there is something on it in the forum. I only see some info on PHPRunner 3 which is obviously outdated. Please help. I can find hiding info from specific groups but not on "empty content.
Please help!

J
Jane 1/29/2008

Stephan,
you need to edit your page on the Visual Editor tab -> HTML mode for this purpose.

Here is a sample:

{if $row.1FieldName_value!=""}

<TR><TD class=shade>FieldName</TD>

<TD {$row.1FieldName_style}>{$row.1FieldName_value} </TD></TR>

{/if}

M
mmponline author 1/29/2008

Jane
Works fine, thanks!
What if the heading is above the data (in a column) like on the list page?

S
swanside 1/29/2008

I would also like to thank Jane for that aswell. Didnt think about it, but it will come in usful.
Thanks

J
Jane 1/30/2008

Stephan,
you need to add {if} tags for all <td> elements in the column in you use horizontal layout on the list page.

M
mmponline author 5/26/2008

Jane
This seem to work on the List page only. When I add the code to the view page, it hides the field whether it's empty or not...

How would I change the code to hide the info when it is empty.
Thanks for your help!

J
Jane 5/26/2008

Stephan,
here is the code for view page:

{if $show_FieldName}

<TR><TD class=shade>FieldName</TD>

...

</TR>

{/if}

M
mmponline author 5/26/2008

Baie dankie! (Pronounced as Buy-a-donkey)
Afrikaans for Thank You very much!

X
xliner 11/28/2008

Jane,
what code symbol needs to be applied on the lines below if one wants to implement the REVERSE mode, say, a kind of TODO list (here a checklist of all activities/bookings to be done around a planned wedding) where only rows of a certain empty field are to be shown on the LIST page...., or in other words, the LIST page would only show not yet solved points of the TODO list???
quote (... do NOT show row when field is empty..., but I would need "only SHOW row" when field is empty..., on LIST page)
you need to edit your page on the Visual Editor tab -> HTML mode for this purpose.

Here is a sample:
QUOTE

{if $row.1FieldName_value!=""}

<TR><TD class=shade>FieldName</TD>

<TD {$row.1FieldName_style}>{$row.1FieldName_value} </TD></TR>

{/if}
Thx in advance - Hajo

J
Jane 11/28/2008

What PHPRunner version do you use?

X
xliner 11/28/2008

What PHPRunner version do you use?


Jane,
PHPRunner 5.0 - Build 689...
Hajo

X
xliner 11/29/2008



Jane,
PHPRunner 5.0 - Build 689...
Hajo


Jane,
I think, the following could possibly provide the starting point (ex EVENTS > LIST > BEFORE DISPLAY) on the issue ...
quote

function BeforeShowList(&$xt,&$templatefile)

{
//** Check if specific record exists ****

global $conn;

$strSQLExists = "select * from AnyTable where AnyColumn='AnyValue'";

$rsExists = db_query($strSQLExists,$conn);

$data=db_fetch_array($rsExists);

if($data)

{

// if record exists do something

}

else

{

// if dont exist do something else

}

unquote
Now..., the empty IF/ELSE lines need to be completed with the correct code...
HTH Hajo

X
xliner 11/29/2008



Jane,
I think, the following could possibly provide the starting point (ex EVENTS > LIST > BEFORE DISPLAY) on the issue ...
quote

function BeforeShowList(&$xt,&$templatefile)

{
//** Check if specific record exists ****

global $conn;

$strSQLExists = "select * from AnyTable where AnyColumn='AnyValue'";

$rsExists = db_query($strSQLExists,$conn);

$data=db_fetch_array($rsExists);

if($data)

{

// if record exists do something

}

else

{

// if dont exist do something else

}

unquote
Now..., the empty IF/ELSE lines need to be completed with the correct code...
HTH Hajo


Jane,
problem solved..., no need to brainstorm on the issue any longer, I shall use an "advanced search URL based" hyperlinked "TODO" button in the site, sequel to http://www.asprunner.com/forums/index.php?showtopic=5704
Hajo