Only display some fields

A place for users and developers of the Xataface to discuss and receive support.

Postby dmilani » Tue Mar 27, 2007 11:28 am

Hi Steve et al,

Trying to implement dataface for our website registration system. I am trying to create an interface that is more friendly than phpMyAdmin for my coworkers to access our online registration system. I am an amature PHP coder and hoping DF will make things a little easier for us.

My current dilemna is how to limit which fields get displayed. Currently we have a couple tables with 16 fields. I would like to limit the list view to only 8 of those fields. Different contexts will require different fields being displayed so I don't want to use the hide function in tables:table_name/fields.ini which I understand will hide the field throughout all of DF's pages. I suspect I have to hard code a variation of the Main Template. My search started with Dataface_List_View.html, which pointed me to the Main Template but I can't figure out where in there to alter things accordingly. I imagine it's here (line 223 of Main_Template) somehow but this code is a bit over my head:

{define_slot name="main_section"}
{if $history and !$ENV.APPLICATION.hide_history}
{block name="before_recently_viewed"}

Recent Records:
{section loop=$history name=i}
{$history[i].recordTitle}
{/section}


{block name="after_recently_viewed"}
{/if}

{block name="before_record_content"}
{define_slot name="record_content"}
{$body}
{/define_slot}
{block name="after_record_content"}


{/define_slot}


Thanks for your help.

Dan
dmilani
 
Posts: 2
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Tue Mar 27, 2007 11:56 am

Hi Dan,

This is a simple thing to do, and you don't even need to change any dataface code.Ê (in fact you shouldn't have to customize any code in dataface to customize your application to the way you like).
You just need to use the visibility:list attribute of the fields.ini file:
http://framework.weblite.ca/documentation/manual/fields_ini/visibility_list
If you want to hide a field from the view tab, you can use the visibility:browse attribute
-Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby dmilani » Tue Mar 27, 2007 1:20 pm

Thanks for the quick reply!

In the context of the fields.ini file is "list" considered an action? For instance is it possible to set up another action "foo" and edit the fields.ini file to:

visibility:foo = hidden
dmilani
 
Posts: 2
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Tue Mar 27, 2007 10:44 pm

Hi Dan,

This would be a nice feature.Ê However, no.Ê visibility:list is just a predefined option the dataface looks for when it is rendering lists of records.

visibility:browse is used when checking whether to include a field in the view tab.

If you create a custom action, you are, in fact able to add your own field attributes and access them via PHP... but that's another ball of wax... let me know if you are interested in this sort of thing and I can post an example to point you in the right direction there.

Best regards


Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 23 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved