[sword-devel] Web Interface
Daniel Adams
sword-devel@crosswire.org
Fri, 21 Feb 2003 16:06:40 -0700
This is a multi-part message in MIME format.
------=_NextPart_000_0016_01C2D9C3.3BA0A8B0
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable
Troy,
I don't know if you remember, but David Woods and I had discussed
somehow redoing the diatheke interface into the SWORD Library, but my
primary interest is in the concordance project that I am working on. If =
you
are possibly going to do this via PHP for websites, I am rather curious =
if
it is possible to get a function to return an array of the different =
book
names and a function to return a single verses text. I do already have =
ideas
of how I am desiring to do this, my goal of it is so that I can link =
into it
directly from my project and not have to use diatheke.exe. If these =
ideas
don't make sense, or if they do and you might want more elaboration of
exactly which functions I am thinking of, please let me know.
I did write a PHP file to be able to extract the module names and also =
the
texts from the diatheke.exe program, but I still desire to be able to
reference directly into the Libraries to get the stuff, thus it might be
faster.
I attached the PHP file that I have used, in it there is a large section
commented out because I have not taken the time to deal with the stuff =
for
regex and the idea of how it links to the Strong's text.
I also have interest in the ability to display GenBooks on a website/PHP
format specifically one verse at a time, such as with the BoM module. I
would be able to reference the module however needed, so format of the
search key for the BoM stuff isn't entirely necessary.
By the Grace of God,
Dan Adams - infoChi@infomagic.net
http://dana.ucc.nau.edu/~dpa3
1 Peter 4:10 (NIV)- Each one should use whatever gift he has received =
to
serve others, faithfully administering God's grace in its various forms.
-----Original Message-----
From: sword-devel-admin@crosswire.org
[mailto:sword-devel-admin@crosswire.org] On Behalf Of Troy A. Griffitts
Sent: Friday, February 21, 2003 3:10 PM
To: sword-devel@crosswire.org
Subject: [sword-devel] Web Interface
Currently, I'm planning to spend next month working on a web interface=20
to the sword engine.
I'd love to get input on what features you like/use from other sites,=20
and what you would like a web interface to a Bible study tool to look =
like.
Please consider GenBook support, as well. What would a general book=20
reader look like for the web?
I'd love any time you have to help design and implement this.
Thank you,
-Troy.
_______________________________________________
sword-devel mailing list
sword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/sword-devel
------=_NextPart_000_0016_01C2D9C3.3BA0A8B0
Content-Type: application/octet-stream;
name="Diatheke.php"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="Diatheke.php"
<%
class Diatheke {
var $Cmd_Str;
=09
function Diatheke($Cmd_Str) {
$this->Cmd_Str =3D $Cmd_Str;
}
=09
function ModNames(&$Ret, $Type) {
static $Abbrev, $Name, $Spot, $Spots; // Using Session Variables more =
HD used though rather than time
$Go =3D false;
if (!is_array($Spot)) { // Make Arrays
$Abbrev =3D array();
$Name =3D array();
$Spot =3D array();
$Spots =3D array();
$ML =3D "$Cmd_Str -b system -k modulelist";
$MLN =3D $ML . "names";
$A =3D 0; $B =3D 0; // Counters
$Num_Types =3D 2;
$Counter =3D 0;
exec($ML, $ML_A);
exec($MLN, $ML_B);
while ($Counter <=3D $Num_Types) {
array_push($Spots, $ML_A[$A]);
$A++;
$Counter++;
while (!strncmp($ML_A[$A], $ML_B[$B], 2)) {
array_push($Abbrev, $ML_B[$B]);
$str =3D substr_replace($ML_A[$A], '', 0, strlen("$ML_B[$B] : "));
array_push($Name, $str);
$A++; $B++;
if (!array_key_exists($B, $ML_B)) break;
}
array_push($Spot, $B);
}
}
if ($Type =3D=3D 0) $Ret =3D $Abbrev;
if ($Type =3D=3D 1) $Ret =3D $Name;
if ($Type =3D=3D 2) $Ret =3D $Spot;
if ($Type =3D=3D 3) $Ret =3D $Spots;
}
function Verse_2($str, &$Ret) {
exec($str, $out);
=09
$Ret =3D $out[0];
// Parse and link to Strong's references if present
// $line =3D~ s/<sync type=3D\"Strongs\" value=3D\"\w?H([0-9]+)\"\/>/<a =
href=3D\"diatheke.pl?verse=3D$1&BDB=3Don\"><$1>\<\/a\>/g;
// $line =3D~ s/<sync type=3D\"Strongs\" value=3D\"\w?G([0-9]+)\"\/>/<a =
href=3D\"diatheke.pl?verse=3D$1&Thayer=3Don\"><$1>\<\/a\>/g;
// $line =3D~ s/<sync type=3D\"Morph\" value=3D\"\w?H([0-9]+)\" \/>/<a =
href=3D\"diatheke.pl?verse=3D$1&BDB=3Don\"><T$1>\<\/a\>/g;
// $line =3D~ s/<sync type=3D\"Morph\" value=3D\"\w?G([0-9]+)\" \/>/<a =
href=3D\"diatheke.pl?verse=3D$1&Thayer=3Don\"><T$1>\<\/a\>/g;
/* $line =3D~ s/<sync type=3D\"Morph\" value=3D\"([^\"]+)\" \/>/<a =
href=3D\"diatheke.pl?verse=3D$1&Packard=3Don\"><$1>\<\/a\>/g;
$line =3D~ s/<sync type=3D\"([^\"]+)\" value=3D\"([^\"]+)\" \/>/<a =
href=3D\"diatheke.pl?verse=3D$2&$1=3Don\"><$1 $2>\<\/a\>/g;
$line =3D~ s/<note [^>]+>/<small>{/g;
$line =3D~ s/<\/note[^>]*>/}<\/small>/g;
$info =3D `$diatheke -b info -k $versions[$i]`;
$info =3D~ /([^\;]+)\;([^\;]+)/;
$format =3D $1;
$type =3D $2;
if ($versions[$i] eq "StrongsHebrew") {
$line =3D~ s/(see HEBREW for )([0-9]+)/<a =
href=3D\"diatheke.pl?verse=3D$2&StrongsHebrew=3Don\">$1$2\<\/a\>/g;
}
elsif($versions[$i] eq "StrongsGreek") {
$line =3D~ s/(see GREEK for )([0-9]+)/<a =
href=3D\"diatheke.pl?verse=3D$2&StrongsGreek=3Don\">$1$2\<\/a\>/g;
}
#case for searches
elsif($search ne "") {
$line =3D~ s/ ([^;\-]+:[^;]+) ([;\-])/urlvers($1, $2, =
$versions[$i])/eg;
}
#case for ThML format texts
elsif($format eq "ThML") {
$line =3D~ s/<scripRef version=3D\"([^\"]+)\" =
passage=3D\"([^\"]+)\">/&plussifyaddress($2,$1)/ge;
$line =3D~ s/<\/scripRef>/<\/a>/g;
}
#case for non-ThML, non-Bible texts
elsif($type ne "Biblical Texts") {
$book =3D $verse; //*/
// $book =3D~ s/^([A-Za-z0-9]+) [0-9]+:[0-9]+.*/$1/;
// $chapter =3D $verse;
// $chapter =3D~ s/[A-Za-z0-9]+ ([0-9]+):[0-9]+.*/$1/;
// $line =3D~ s/\#*([1-9]*[A-Z][a-z]+\.*) =
([0-9]+):([0-9]+-*,*[0-9]*)\|*/<a =
href=3D\"diatheke.pl?verse=3D$1+$2%3A$3&$defversion=3Don\">$1 =
$2:$3\<\/a\>/g;
// $line =3D~ s/\#([0-9]+):([0-9]+-*,*[0-9]*)\|*/<a =
href=3D\"diatheke.pl?verse=3D$book+$1%3A$2&$defversion=3Don\">$book =
$1:$2\<\/a\>/g;
// $line =3D~ s/\#([0-9]+-*,*[0-9]*)\|*/<a =
href=3D\"diatheke.pl?verse=3D$book+$chapter%3A$1&$defversion=3Don\">$book=
$chapter:$1\<\/a\>/g;
/* }
if ($locale ne "abbr") {
$line =3D~ =
s/href=3D\"diatheke.pl([^\"]+)\"/href=3D\"diatheke.pl$1&locale=3D$locale\=
"/g;
}
// */
}
function Verse($Search, $Version, $Verse, $Of =3D '', $MaxVerses=3D50, =
$Locale=3D'en') {
$Ret =3D '';
// Search to perform in this book.
if ($Search !=3D '') $Search =3D '-s ' . $Search;
$str =3D "$this->Cmd_Str $Search $Of -m $MaxVerses -f thml -l $Locale =
-b $Version -k $Verse";
$this->Verse_2($str, $Ret);
$Ret =3D str_replace("$Verse: ", '', $Ret);
$Ret =3D str_replace("($Version)", '', $Ret);
return $Ret;
}
}
%>
------=_NextPart_000_0016_01C2D9C3.3BA0A8B0--