Next · Vim Navigation · Home > Etcetera > Techology > Parallel

Simple Parallel Bible (PHP/MySQL)

The Simple Parallel Bible is a search and lookup tool that can be easily added to any PHP/MySQL website. It lets you link to multiple passages, in parallel (for side-by-side comparison) or in a list, with a single link, without leaving your website.

2007-02-19 -- The 0.6.0 release (a) corrects two bugs which caused abbreviated sequential references to display incorrectly (thanks, Matthew V. for the bug report), (b) simplifies search results, and (c) adds virtual paths. So instead of /bible/index.php?q=john+3.16, or even /bible/?q=john+3.16, you can now link to /bible/john+3.16, IF your Apache configuration supports mod_rewrite and .htaccess (see below).

Email me with any questions, or Add feedback to this page.

Page contents
1.  License (GPL)

The Simple Parallel Bible is distributed under the GNU General Public License. Take it, use it, change it, enjoy.

Add a link2 links in this section
GNU General Public License (GPL)
From OpenSource.org, the text of the leading open source software license. The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.
World English Bible
Modern English, no copyright -- perfect for web use! The Simple Parallel Bible presently uses the World English Bible.
Add a link 2.  Screenshots and overview

Some screenshots of version 0.5.2; almost the same as the current version.

Figure 1. Simple

The Simple Parallel Bible, as the name suggests, is mainly designed for simplicity. Thus there are no radio buttons or checkboxes to complicate the interface. The program determines from the nature of each query whether a search or a lookup is being performed. It correctly handles terms like 'Philemon', which it recognizes as a passage reference rather than a search term.

.

Figure 2. Parallels

When queries are separated by pipe '|' characters, they are displayed in parallel, for side-by-side comparison. A maximum of four parallel queries can be shown for the sake of readability.

Figure 3. Ranges

Passages references can include dashes and commas to indicate ranges. In the results, an ellipsis (...) will indicate any omitted text. Passages separated by slashes will be shown in sequence, and book names, if omitted will carry on from the prededing term.. A maximum of ten sequential queries can be shown.

Figure 4. Search

The search facility is primarily designed for ease of use. Terms are combined with an AND, so adding terms narrows a query. Terms will match any part of a word. Lowercase queries search the New Testament, while uppercase queries search the Old Testament. One of the quirks of the World English Bible, the fact that the word church never appears, is illustrated in this example.

Add a link 3.  Promotion

To plug the Simple Parallel Bible in an email newsletter, or some such forum, you might use the following text:

The Simple Parallel Bible is a search and lookup tool that can be
freely added to any PHP/MySQL website. It lets you link to multiple
passages, in parallel (for side-by-side comparison) or in a list,
all with a single link and without leaving your own site.

http://jesus.com.au/demo/bible/index.php
http://jesus.com.au/demo/bible/index.php?q=matt+19.16-30|mark+10.17-31|luke+18.18-30
http://jesus.com.au/demo/bible/index.php?q=matt+5.43-48/6.5-8,19-21/7.24-28

In HTML you might say —

The Simple Parallel Bible is a search and lookup tool that can be freely added to any PHP/MySQL website. It lets you link to multiple passages, in parallel (for side-by-side comparison) or in a list, all with a single link and without leaving your own site.

The <a href="http://jesus.com.au/demo/bible/index.php">Simple Parallel Bible</a> is a search and lookup tool that can be freely added to any PHP/MySQL website. It lets you link to multiple passages, <a href="http://jesus.com.au/demo/bible/index.php?q=matt+19.16-30|mark+10.17-31|luke+18.18-30">in parallel</a> (for side-by-side comparison) or <a href="http://jesus.com.au/demo/bible/index.php?q=matt+5.43-48/6.5-8,19-21/7.24-28">in a list</a>, all with a single link and without leaving your own site.
4.  Installation: FTP

If you have shell access on a Linux/UNIX server see the second install guide, below. This is a general guide to installing the Simple Parallel Bible by FTP. Let me know if you have any trouble.

  1. Make sure you have your FTP details and your MySQL user name, password and database name, and the URL of your MySQL Web Admin Service. Contact your web hosting service if you do not know any of these details.
  2. Download the following two files to your PC: bible.tar.gz and web.sql.gz
  3. unzip and untar bible.tar.gz with WinZip, Powerarchiver, StuffIt, gunzip or whatever you happen to use on your computer.
  4. in the new bible subdirectory, edit the setup.inc.php file, so that it contains your MySQL username, password and database name
  5. Upload the bible directory to your website using your FTP client
  6. Open a web browser, point it at your web host's MySQL Web Admin service, and log in. You should see an option to upload and execute an SQL file. If this handles gzipped files (most do), you can upload the web.sql.gz file as it is. (Otherwise unzip it first, this means a roughly 10 Meg upload, however, which may not be possible or practical.)
  7. Click 'Browse', and choose the web.sql.gz file, then hit submit in the web form. Unless you have a really fast connection, go make a cup of coffee or something at this point. The script, when it has run will produce two new tables in your database: bible_books and bible_verses, containing the World English Bible.
  8. Now point your browser at the bible directory you have just created on your website. You should see something looking exactly the same as our demo site. Click some of the demo links to check that everything works.

And there you go. Once again, Contact me if you have any technical problems or any comments, good or bad. Don't contact me if you're having trouble with basic concepts like FTP. There are hundreds of tutorials online for FTP, MySQL, unzipping, etc. Google is your friend.

Add a linkOne link in this section
Google Search Engine
The world's most popular search engine.
Add a link 5.  Installation: Linux shell

Move to your website's root directory, then get the two files you need via http. wget is simplest, though lynx --source does much the same thing once you pipe it to a file, and is available on more servers.

wget http://jesus.com.au/demo/bible.tar.gz
wget http://jesus.com.au/demo/web.sql.gz

Untar the bible/ directory.

$ tar -xzf bible.tar.gz

Create the database containing two tables: bible_books and bible_verses. It may take half a minute to add the 30,000 verses and then create their indexes.

$ gunzip web.sql.gz
$ mysql -u {username} -p {databasename} < web.sql > sql.log
Password: {userpassword}

Obviously, insert the appropriate {value} between the curly brackets. I recommend either running SQL in quiet mode, or piping the output to a logfile -- as I have done here -- unless you want a few thousand screenfuls of line-by-line INSERT confirmations.

Edit bible/setup.inc.php so that it contains your database access details:

$database_host = '';
$database_user = '{username}';
$database_pass = '{userpassword}';
$database_name = '{databasename}';

Point a browser at the front-end, and away you go.

http://yoursite.com/bible/?q=luke+15
Add a link 6.  Upgrading to version 0.6.0.

To upgrade to the latest version, you only need the new version of bible.tar.gz. The database is unchanged. The following instructions assume the Simple Parallel Bible is located at http://{your-web-site.org}/bible/; adjust if necessary.

First, rename your old directory from /bible to /bible2 (so you still have a working copy, whatever happens). Then unpack the new bible.tar.gz to create the new bible directory, and add your database details to setup.inc.php -- i.e. proceed as you would with a new installation of the files. Then view /bible/ on your server, and test that the example links work.

What you will need to check is whether your system supports virtual paths (see below), i.e. whether it has .htaccess and mod_rewrite enabled. If the default install returns a 'file not found' error when you try to view a verse, say /bible/luke+15, then set the $virtual_paths variable to false in setup.inc.php. You will need to link to verses or searches using the 'q' variable, e.g. /bible/index.php?q=luke+15.

Add a link 7.  Virtual paths in Apache2 with mod_rewrite and .htaccess

When you add your database connection details to the setup.inc.php file, you will notice a line that reads $virtual_paths = true;. This enables the most intuitive linking, by allowing you to omit the 'index.php?q=' part of any links. It lets you link directly to /bible/matt+28, for example.

This depends on your web server being Apache, and being configured to support both .htaccess and mod_rewrite. These allow the index.php file to handle ALL paths which start with /bible/ (or whatever your directory path is).

If the example links on the help page return 'file not found' errors, you need to EITHER set this variable to false, OR activate these two services, OR get your web hosting service to do so. If in doubt, take the first or third options.

If you administer your own server, then you will probably understand the following instructions, which cover the default Debian Linux install of Apache2, and may be able to adapt them to your needs. Note that while this is what works on my systems, yours may do things differently, so consult your usual sources for more information.

  1. .htaccess is enabled by removing any line that says 'AllowOverride None' in the Directory section of the appropriate VirtualHosts file in /etc/apache2/sites-available.
  2. mod_rewrite is enabled by executing the command sudo a2enmod rewrite.
  3. Neither change takes effect until you restart the web server, e.g. with sudo apache2ctl restart.
Add a link 8.  Known Issues

These will be corrected in the next round of changes. Surprisingly, people who offer feedback or suggest improvements never seem to notice that:

  • Several hundred OT verses contain footnote links which do not work, and need to be removed or replaced with DFN tags. Searching for 'DIATHEKE' (capitals) finds these.

While I'm discussing the database, if anyone wishes to put any other freely distributable Bible translations into the following database format I'm happy to host the SQL files.

mysql> desc bible_verses;
+-------+--------+------+-----+---------+-------+
| Field | Type   | Null | Key | Default | Extra |
+-------+--------+------+-----+---------+-------+
| b     | int(4) | YES  | MUL | NULL    |       |
| c     | int(4) | YES  |     | NULL    |       |
| v     | int(4) | YES  |     | NULL    |       |
| t     | text   | YES  | MUL | NULL    |       |
+-------+--------+------+-----+---------+-------+
5 rows in set (0.00 sec)

Thats book, chapter, verse and text columns (in HTML), respectively. Use the existing WEB database as a guide if unsure. I'll add the indexing.

9.  A note to Bible copyright holders

Many good quality English-language Bible translations presently benefit almost no-one, least of all their copyright holders, having negligible market share.

Distribution licenses exist, however, which could give such translations a new lease of life. They would allow copyright holders to increase the distribution and usability of their texts, at little or no cost, while preserving their ownership and publication rights. The best known of these licenses, which cost nothing to use, are published by Creative Commons, and generally indicated by the phrase Some Rights Reserved.

For example, a copyright holder might allow:

  • free distribution of their unmodified text only,
  • for non-commercial purposes only,
  • in digital formats only, and
  • only if the copyright owner is credited in all copies

Under such a license, anyone who distributed the text of a translation without observing its license conditions would forfeit any right at all to use it, and could be prosecuted in the normal manner for copyright violation.

From several perspectives, there are good reasons to consider this kind of licensing for Bible texts that would otherwise be declining, or those for which print editions are increasingly unviable.

  • It scarcely needs to be said how much this would benefit Christian ministries, especially those involved in Bible distribution, by allowing them to take the fullest advantage of the internet and digital media.
  • Or, for that matter, how additional exposure and goodwill would benefit the first few translations to take such a step -- perhaps even reviving the demand for print editions.
  • And it should be evident how such a step would serve the obvious fundamental goal that drives the production of a Bible Translation in the first place: That people would read it.
  • Also, while respecting the need to recoup translation and publishing costs, at least some of the best modern translations should be made freely available, on biblical principles alone.
  • Finally, web techs like myself need nothing more than such a license to develop a whole new generation of freely distributable bible software tools, like the Simple Parallel Bible, using modern and authoritative translations.

If you represent the copyright holder for a modern English translation, and are potentially interested in this, but think that downloads from your website would be a cost issue, please contact me; I can probably arrange hosting with no such limitations.

Similarly, I would be happy to provide, or help you find, any further information you require on this subject. But the best source of information is probably the Creative Commons website.

Add a linkOne link in this section
Creative Commons
Creative commons licenses allow copyright holders to release their work for free distribution, under specific conditions, without losing copyright control. Such licenses cost nothing to use.
10.  Similar programs

I'm not aware of anything quite like the Simple Parallel Bible elsewhere. The following links may assist you if you're looking for something similar, however.

Add a link2 links in this section
Freshmeat.net / Simple Parallel Bible
The Freshmeat site collects open source projects for Linux and related operating systems. As you can see, the Simple Parallel Bible is listed in the 'Religion' category.
SourceForge.net
SourceForge is probably the largest repository of open source software projects in the world.
11.  Future developments

Someone asked where I see this project going over time -- Well:

  • I'd like to keep it simple -- the simple, unified interface is a major functionality point.
  • I'd like the multi-lingual version to have a big long list of SQL language files that can be downloaded. Currently I have Ancient Greek and possibly Vietnamese -- but that's not officially public yet.
  • I'd like to change the Ancient Greek version to fully polytonic Unicode: ἐν ἀρχῇ ἦν ὁ λόγος, καὶ ὁ λόγος ἦν πρὸς τὸν θεόν, καὶ θεὸς ἦν ὁ λόγος. I have the sources, it will just take some heavy processing.
  • I might create an 'advanced parallel bible' -- a separate project branch with a more complex interface. If I did, I'd like to allow the administrator to group books into searchable lists (e.g. Pauline letters, Pastorals, undisputed Paulines, Corinthians (together), etc... whatever they want to make block-searchable), and throw in porter-stemming of search queries (so love automatically matches loving, loved, etc). And I might add a grammatical concordance for Greek, or mouse-over parsing. I've wanted an excuse to write some grammatical software for ages. :)
  • I'd like the publishers of the NRSV and the NA26/27 Greek to release their texts under Creative Commons licenses allowing free redistribution, with attribution, without modification, for non-commercial purposes.
  • I'd like to create an online, interactive harmony of the gospels, perhaps at Jesus.com.au. Though I've toyed with the idea of an interactive web commentary, like a biblical kind of wikipedia. A better idea, though, would be to have a database of the parallels, so that they can be automatically cross-referenced or parallelled with a single click.
  • It's fairly well style-sheeted at the moment, but it could do with some graphical theming.
  • And a function library to make it easy for other PHP programs to quickly pull out individual or random passages.
Add a linkOne link in this section
Creating Multilingual Web Pages
Subitled: Unicode Support in HTML, HTML Editors and Web Browsers. For anyone interested in creating new second-language editions of the Simple Parallel Bible.
Email editors · Add feedback Showing 3 feedback items for this page
  • Great SQL File — Thank you for these files, it really enhances my project.   Fri 16 Nov 2007
  • Thank you for this project! — Madison Park Christian Church truly appreciates this piece of OpenSource software. I also want to personally thank you for taking the time to make some changes in your project at my request. Thank you Nigel! Our sermon archive is a much more...   Thu 26 Jul 2007
  • I love this SQL file — It was exactly what I needed to add more functionality to our website.   Mon 24 Oct 2005
Top of page About this page · Display