Abstract page template

From EPrints Documentation
Jump to: navigation, search

If you want to apply a specific template to an item's abstract page (summary page), you can return a template name from the 'eprint_render' function. See: https://github.com/eprints/eprints/commit/4656cbc1398f52ddbef7d245795d12f7dc35d8a2

$c->{eprint_render} = sub
{
# ...
# all the normal stuff eprint_render stuff
# ...

    #example shows using a specific template for articles. You can test for 
    # whatever you want - as long as you return a valid template name, or 
    #leave $template undefined - in which case the default template is used.
    my $template;
    if( $eprint->value( "type" ) eq "article" ){
        $template = "article_template";
    }

    #normally returns just $page, $title, $links, but can return $template too!
    return ( $page, $title, $links, $template );
}

Tested in EPrints-3.3.10 and EPrints-3.3.12. Probably works on many other versions.