Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
When citations are displayed by type or type-year, types are ordered alphabetically (BY type DESC). But in an academic use, Books are often presented first, then journal articles and report at the end.
It would be fine to have the possibility to specify in initialize/ini.inc.php the order of types to display.
Below, a suggestion:
In initialize/ini.inc.php, add :
// When results are displayed by type, type order to use:
// The specified reference types must have matching entries within the 'types' MySQL table.
$typeOrder = "'Book Whole','Book Chapter','Journal Article','Journal','Thesis','Conference Volume','Conference Article','Report','Abstract','Patent','Software','Magazine Article','Newspaper Article','Manual','Manuscrit','Map','Miscellaneaous'";
// e.g. "'Book Whole','Book Chapter','Journal Article','Journal','Thesis','Conference Volume','Conference Article','Report','Abstract','Patent','Software','Magazine Article','Newspaper Article','Manual','Manuscrit','Map','Miscellaneaous'"
// When results are displayed by type, thesis order to use:
// The specified reference types must have matching entries within the 'thesis' field in 'ref' MySQL table.
$thesisOrder = "'Habilitation thesis','Ph.D. thesis','Doctoral thesis','Master\'s thesis','Diploma thesis','Bachelor\'s thesis'";
// e.g. "'Habilitation thesis','Ph.D. thesis','Doctoral thesis','Master's thesis','Diploma thesis','Bachelor's thesis'"
In search.php, show.php and includes/include.inc.php, replace :
ORDER BY type DESC, thesis DESC
ORDER BY FIELD(type, $typeOrder), FIELD(thesis, $thesisOrder)
In includes/include.ini.inc, line 2453, add:
global $typeOrder, $thesisOrder; // defined in 'ini.inc.php'
In search.php, line 4911 and line 5018, add :
An example of a custom type order can be viewed here :
Note: be careful. This code is just proposed to discussion, not to be used in production. It can produce some errors.
A problem identified (but I don't know how to fix the problem):
With the modified show.php:
With a web navigator:
- show.php?records=all&citeOrder=year OK no problem
- show.php?records=all&citeOrder=type OK no problem
With use of file_get_contents in a php script:
- file_get_contents('http://url_of_refbase/show.php?records=all&citeOrder=year') OK no problem
- file_get_contents('http://url_of_refbase/show.php?records=all&citeOrder=type') doesn't work: Error 1065 : Query was empty
thanks for all your recent forum contributions, keep it coming! I'm a bit busy with other things right now, but I'll try to respond as soon as I can.
Your proposal looks interesting, and it would be nice to support something along these lines. However, I haven't actually been able to test it yet.
W.r.t. 'file_get_contents()', have you tried to use 'fopen()' instead? refbase uses 'fopen()' in 'index.php' via function 'fetchDataFromURL()' (in file 'includes/include.inc.php'), and this doesn't seem to pose any problems with 'citeOrder=type'.