form output and ordering

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

Postby generatedname » Wed Jan 31, 2007 1:23 pm

Going to try one more time ><


>



>


echo '';

>foreach ($records as $record){

echo '';

> -----------------This is where I want to start the for loop for each field in the record----------------

echo '';

> -----------------Ending it here-------------------------------------------------------------------------

echo '';

> /unset($record);

>}

echo '
';

> -----------------Print the Field data here--------------------------------------------------------------

echo '
';

>
generatedname
 
Posts: 53
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Wed Jan 31, 2007 2:13 pm

There are a number of ways to loop through the fields:

1. Simple way.

foreach ($record->strvals() as $fieldname=>$fieldvalue){
echo "Name: $fieldname ; Value: $fieldvalue";
}

2. Using the Dataface_Table class, you can get the fields using the fields().
foreach(array_keys($record->_table->fields()) as $fieldname){
// Then you can do any of the methods of accessing the field available.
$record->val($fieldname); // gets the raw value from the field
$record->strval($fieldname); // gets the value as a string (e.g. date fields are stored as arrays normally - so this converts it to a string).
$record->display($fieldname); // Cleans up output to to be displayed on a without html special chars.
$record->htmlValue($fieldname); // Formated for web page.
}

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

Postby generatedname » Mon Feb 05, 2007 10:24 am

I had this "working" but it was just showing every record, every field, in the whole table when they tried to print. I was trying for something that would take exactly the table from the list_view and show only that, with maybe a couple of added lines of text at the top.

Thanks,

Kurtis
generatedname
 
Posts: 53
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Mon Feb 05, 2007 11:35 am

Why not just use the list action instead of your own custom action then?

You can use Stylesheets to customize how the output looks on a printer.

http://webdesign.about.com/cs/css/a/aa042103a.htm


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

Previous

Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 7 guests

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