Difference between revisions of "Dynamic Template System"

From EPrints Documentation
Jump to: navigation, search
 
(to disable the creation of the unused .html file)
Line 8: Line 8:
  
 
index.title.textonly is the version of the title with any markup removed, so that it can safely be used in the title tag in the head of the document.
 
index.title.textonly is the version of the title with any markup removed, so that it can safely be used in the title tag in the head of the document.
 +
 +
 +
The .html file is only used if you turn dynamic templates off. In theory this would speed up serving these pages.
  
 
== to disable the creation of the unused .html file ==
 
== to disable the creation of the unused .html file ==

Revision as of 16:43, 11 April 2007

EPrints 2 generated static pages as .html files, by filling in the blanks in the template.

EPrints 3 still does this and writes out .html files but THESE ARE NOT USED unless you choose to turn dynamic templates off.

Dynamic templates mean that some part of the template can change depending on other factors. This is used to show the "you are now logged in as ...." section in the header. You could also use it to show other information (last 3 eprints added, the date and time, etc.). If you do add the last 3 items, make sure it's not doing the search on every page - cache it in a file!

The dynamic template system writes each part of the page out into a separate file. eg. index.title, index.page etc. These are then combined into the template to print the page. This is pretty fast as it does not use the XML library but just concatinates strings. The only XML library bit is the dynamic part, the "now logged in as" section.

index.title.textonly is the version of the title with any markup removed, so that it can safely be used in the title tag in the head of the document.


The .html file is only used if you turn dynamic templates off. In theory this would speed up serving these pages.

to disable the creation of the unused .html file

(someone asked for how to do this)

In perl_lib/EPrints/Session.pm find write_static_page and add:

return;

just before

       my $html_file = $filebase.".html";
       $self->prepare_page( $parts, page_id=>$page_id );
       $self->page_to_file( $html_file, $wrote_files );
}

This is untested!