Jump to content
Wiki Home
EPrints Home
Bazaar
Files
Main menu
Main menu
move to sidebar
hide
Navigation
Front Page
EPrints 3 Manual
EPrints Training Course
EPrints Glossary
Installing EPrints
How-to Configure EPrints
EPrints 3.2+ API
EPrints 3 Reference
EPrints Plugins
Wiki
All categories
Recent changes
Main Page
Help
EPrints Documentation
Search
Search
Appearance
Log in
Request account
Personal tools
Log in
Request account
Pages for logged out editors
learn more
Contributions
Talk
Editing
How to
(section)
Page
Discussion
British English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==HOW TO: Website Integration== ===Make the latest additions to your archive appear on your main website=== The contents of the "latest" page - /perl/latest - can be included via a cron tab using wget and a server side include or using something like PHP's command to do: readfile( "http://eprints.foo.org/perl/latest?mainonly=yes" ); The "mainonly=yes" flag is a hack which supresses the template of any eprints page in the /perl/ area so that it can be included, but it is most useful for "latest". WARNING: If you have a script which imports 1000 records in one night then latest isn't currently bright enough to truncate the list so your homepage could get kinda messy. ===RSS into HTML=== If you want to turn any search into a dynamically generated list of references with a link back to the EPrints page, then use this. This solution uses PHP. So, you will need PHP enabled on the server. '''Dependency:''' This code depends on [http://magpierss.sourceforge.net/ MagpieRSS]. '''Original Context:''' It was developed for use in a [http://www.terminalfour.com/ Terminal4 'SiteManager'] template, but can be used with almost no modification. The code implements local caching of the generated HTML in a text file which is never more than an hour old, unless there is a problem with the server whereupon the last good cached version is used. require_once('D:/website/[path to]/magpierss/rss_fetch.inc'); <span style="color: green; font-weight: bold">//set some variables here:</span> $anchor = '<t4 type="meta" meta="html_anchor" />'; <span style="color: green; font-weight: bold"># All items in Terminal4's cms have an anchor - we like break it apart to get the Unique id, to name the cache file.</span> $TTL = 3600; <span style="color: green; font-weight: bold"># Time to live - one hour only.</span> $feed = '<t4 type="content" name="RSS_Feed_URL" output="normal" modifiers="" />'; $uniqueID = explode("\"", $anchor); $filename = "./" . str_replace('.', '-', $uniqueID[1]) . ".txt"; <span style="color: green; font-weight: bold">#filename of cache - generated from unique id in T4 content management system.</span> $max_items = <t4 type="content" name="MaxNumberToShow" output="normal" modifiers="" />; <span style="color: green; font-weight: bold"># $max_items = 30; // this is set in EPrints as well, will not exceed Eprints' own internal limit.</span> $with_summaries = '<t4 type="content" name="ShowSummary" output="normal" modifiers="" />'; # could be 'yes' or 'no' $age = 0; if(file_exists($filename)){ $age = time() - filemtime($filename); }else{ $fh = fopen($filename, "w"); fwrite($fh, $news_feed); fclose($fh); $age = $TTL; } function getFromCache($f){ $fh = fopen($f, "r"); $size = filesize($f); $data = fread($fh, $size); print $data; fclose($fh); } if($age >= $TTL){ if($rss = fetch_rss($feed)){ $items = array_slice($rss->items, 0); $find = array("/^\.?/"); $replace = array(" "); $news_feed = "<ul class=\"rss_list\">\n"; foreach ($items as $item ){ if($count < $max_items){ $news_feed .= "\t<li class=\"rss_item\">\n"; $news_feed .= "\t\t<span class=\"rss_title\"><a href=\"" . $item['link'] . "\" target=\"_blank\">"; $news_feed .= $item['title'] . "</a></span>\n\t\t<br />\n"; if($with_summaries == 'yes'){ $news_feed .= "\t\t<span class=\"rss_summary\">\n\t\t\t"; $news_feed .= str_replace(($item['title'] . "."), "", htmlentities($item['summary'])) . "<br/>\n\t\t</span>\n"; } $news_feed .= "\t\t<br />\n\t</li>\n"; $count += 1; } } $news_feed .= "</ul>\n\n"; echo $news_feed; $fh = fopen($filename, "w"); fwrite($fh, $news_feed); fclose($fh); }else{ getFromCache($filename); } }else{ getFromCache($filename); } <span style="color: green; font-weight: bold"># David Kane, Waterford Institute of Technology</span>
Summary:
Please note that all contributions to EPrints Documentation may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
EPrints Documentation:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)