EPrints Technical Mailing List Archive

Message: #01584


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

[EP-tech] Re: {Disarmed} summary page with link


On Fri, 2013-02-15 at 13:33 +0100, Marc Marc wrote:
> Hi all,
> 
> 
> In my EPrints database I have a field 'catalogue_id' (e.g. ID00021)
> and I would like to create a link on the summary page:
> <a href="http://mycatalogue.com/search?ID00021";>Catalogue link</a>
> 
> In EPrints 3.0.5 I used the following code
> (/cfg/cfg.d/eprint_render.pl):
> 
>      my $catalogue_link = $session->make_element( "div",
> class=>"ep_block",
>      style=>"margin-bottom: 1em" );
>      my $cataloguelink = "MailScanner has detected a possible fraud
> attempt from "3c.gmx.net" claiming to be
> http://mycatalogue.com/search?"; .
> $eprint->get_value( "catalogue_id" );
>               $catalogue_link->appendChild( $session->html_phrase(
>                         "page:catalogue_link",
>                         url => $session->make_text( $cataloguelink ),
>                         link =>
> $session->render_link( $cataloguelink ) ) );
>               $page->appendChild( $catalogue_link );
>               
> How can I do this in EPrints 3.3.x?
> The summary page will be created via:
> /cfg/cfg.d/eprint_render.pl
> /cfg/citation/eprint/summary_page.xml

Hi,

What I would do is add a custom render method to your field definition
then in summary you can simply do:

<epc:print expr="catalogue_id" />

See:
http://wiki.eprints.org/w/API:EPrints/MetaField#Rendering

i.e.
{
name => "foo",
type => "id",
render_value => \&render_catalogue_id,
};

sub render_catalogue_id
{
my ($repo, $field, $value) = @_;

... render code
}

-- 
All the best,
Tim

Attachment: signature.asc
Description: This is a digitally signed message part