Tech List

[index] [prev] [next] [options] [help]
See the Mailing Lists Page for how to subscribe and unsubscribe.

eprints_tech messages

Please note: this page shows emails that have been sent to the eprints_tech mailing list. Some of these may be spam emails we have failed to filter.

[EP-tech] how to render a multilang compound field

From: Zeno Tajoli <tajoli AT cilea.it>
Date: Sun, 12 Oct 2008 19:35:42 +0200


Threading:      • This Message
             Re: [EP-tech] how to render a multilang compound field from tdb01r AT ecs.soton.ac.uk

*** 
http://www.eprints.org/tech.php/id/%3C200810121802.m9CI2gLJ031106%40petrel.ecs.soton.ac.uk%3E
*** EPrints community wiki - http://wiki.eprints.org/

Hi to all,

I have a multilang compound field and I want to 
render it with only one value for every repetion,
not with a table (like the standard).

My field definition (from eprint_fields.pl) is:
{	'name' => 'othersabs', 'type' => 'compound', 
'multiple' => 1, 'input_boxes' => 1,
            'fields' => [
                      {'sub_name'=> 
'othabstracts', 'type' => 'longtext', 'input_rows' => 10, },
                      {'sub_name' => 'language', 
'render_quiet' => 1, 'type' => 'set', 'options' 
=> ['af', 'eu', 'it', 'en', 'zh'],}
                      ],
},

A simple rendering is this (from eprint_render.pl):

if( $eprint->is_set( "othersabs" ) )
         {
                 my $div = $session->make_element( "div", 
class=>"ep_block" );
                 $page->appendChild( $div );
                 $p = $session->make_element( 
"p", style=>"text-align: left; margin: 1em auto 0em 
auto" );
                 $p->appendChild( $eprint->render_value( "othersabs 
) );
                 $div->appendChild( $p );
         }

The result is a table with two colums (html code):
<div><table>
<tr><td>othabstracts</td><td>language</td></tr>
<tr><td>1°  abstract</td><td>1° 
language</td></tr>
<tr><td>2° astracts</td><td>2° 
language</td></tr>
</table>
</div>

This the default results, but I don't like it.
I want a display with only the two abstracts.

A rendering with only the two abstracts is  (from eprint_render.pl):

if( $eprint->is_set( "othersabs" ) )
         {
                 my $div = $session->make_element( "div", 
class=>"ep_block" );
                 $page->appendChild( $div );
                 $p = $session->make_element( 
"p", style=>"text-align: left; margin: 1em auto 0em 
auto" );
                 $p->appendChild( 
$eprint->render_value( "othersabs_othabstracts" ) );
                 $div->appendChild( $p );
         }


As result I see this http://eprints3.cilea.it/8457/.
The two abstract are in only one <div> all 
together and it is difficult to discriminate between them.
The html code is :
<div> 1°  abstract2° astracts</div>

Do you know how to discriminate betweeb the two fileds ?
I want to do a result like <div> 1°  abstract <br> 2° 
astracts</div>

But I don't know what to use instead of render_value function.

Thank you very much for your attention

Bye


Zeno Tajoli
CILEA - Segrate (MI)
tajoliAT_SPAM_no_prendiATcilea.it
(Indirizzo mascherato anti-spam; sostituisci quanto tra AT con  AT )



[index] [prev] [next] [options] [help]