Hello every one, I'm sure I'm on the right place.
Firs, I'm new to php but want to learn, so I'm getting to it, but for now here is my problem.
I'm building a website (HTML & CSS mostly) for a Christian group, they give me the bible on a text file...
so I suppose I have to put some link (when clicked) to open a PopUp with the correct row from the bible...
Inside that text file, data is separated by tabs, here are a few rows from that file to help me better explain myself.
---------------------------------------------------------------------------------------------
1 1 1 1 En el principio creó Dios los cielos y la tierra.
2 1 1 2 Y la tierra estaba desordenada y vacía, y las tinieblas estaban sobre la faz del abismo, y el espíritu de Dios se movía sobre la faz de las aguas.
3 1 1 3 Y dijo Dios: Sea la luz; y fue la luz.
4 1 1 4 Y vio Dios que la luz era buena; y apartó Dios a la luz de las tinieblas.
---------------------------------------------------------------------------------------------
The first tab is the order verse #
The second tab is the Book name
The third tab is the chapter
The forth tab is the actual verse #
the fifth tab is the actual text of that verse
So far this is what I've gotten:
$lines = file("biblia/valera1602_1865.txt");
$books = array(1=>"Genesis"); //etc, etc.
$l_count = count($lines);
foreach($lines as $line) {
$parts = explode("\t", $line);
$book = $books[$parts[1]];
$chap = $parts[2];
$verse = $parts[3];
$text = $parts[4];
echo "{$book} {$chap}:{$verse} {$text}\n";
}
The problem is it outputs the whole bible with genesis as the name of all the books, of course I dont know how to properly create an array of all books and what I need is to retrieve only one book, one chapter and one verse. I know a database is recommended but my Christian friends just feel more closely to the book if they can see it.
What I need is to output the verse like this:
1. Ignore first tab
2. Convert the second tab into (a string) the books name (from an array I guess)
3. Output the third and forth tabs next to the outputted string from the second tab with a semicolon in the middle of the third and forth echo string ex. (Genesis 1:1 En el principio creó Dios los cielos y la tierra.)
4. Output the actual verse after the echoed tabs string (like in the example above)
I'll attach a couple of files that might help explain myself better.
This is possibly a ticket to heaven so there. Can some one help me with this?
Thank You for your help
[attachment deleted by admin]