Fork me on GitHub

Anyone able to help with phpbible?  Bottom

Go to page 1 - 2 [+1]:

  • I've installed phpbible and it mostly works but I can't get references (e.g. John 3:16) to work. It looks like something went wrong when the reference index was built. Anyone using phpbible able to give me a hand? Thanks.
  • Hello,

    I have phpBible working. Maybe I can help you. Can you provide more details about what went wrong?
  • Thanks,

    I don't recall anything failing when I installed but when I try and look up by reference I get

    Passage not found in one or more requested documents.

    Looking at the SQL query that's generated I suspect that the index that is built when you add a Bible text is incomplete. For example typing 'John 3:16' gives

    Code

    SELECT nuke_pb_doc_KJV.chr_start, nuke_pb_doc_KJV.chr_end, nuke_pb_doc_KJV.id, nuke_pb_doc_KJV.titles FROM nuke_pb_doc_KJV WHERE 1 AND ( nuke_pb_doc_KJV.ref LIKE 'John.3.16.%' OR nuke_pb_doc_KJV.ref LIKE 'John.3.16' )


    So the reference has been coverted to the OSIS format (John.3.16) but if I look in the nuke_pd_doc_KJV table I can only see an entry with ref='John', there are no entries with chapters and verses.

    If this makes sense to you could you query your database and tell me if there are records for chapter and verse. Could you also tell me where you downloaded your OSIS texts, maybe mine are not completely compatible with phpbible.
  • Well, after some investigation I've found the problem. The XML parser in phpbible is very intolerant of variations in the OSIS documents that are out there.


    • 1. It won't cope with verses defined as

    • Code

      <verse ... />


    • Changing them to

    • Code

      <verse ...> ... </verse>


    • fixes that.

    • 2. It doesn't cope with multiple verses on one line

    • 3. It can't handle the quotation scheme

    • Code

      </q ...>



    With a bit of fiddling via a perl script I've managed to transform one text into a form that seems to work. Shame that this project is not actively being maintained. If these niggles were fixed then it would be a pretty good module.
  • I get the following error when I try to access the module, right after initializing and activating phpbible:

    Code

    Fatal error: Cannot redeclare _smarty_sort_length() (previously declared in /home/sco/public_html/modules/phpbible/library/utils/smarty/pbSmarty_Compiler.class.php:1835) in /home/sco/public_html/includes/classes/Smarty/Smarty_Compiler.class.php on line 2290


    Any help is greatly appreciated. :)
  • I actually just recently tore open this code in an effort to better integrate it with postnuke and remove it's smartification (which is were the redeclaring error comes from, my home system doesnt' call it a "fatal" error but it does show in the apache error logs).

    I believe that the parsing errors might come from the fact that the file class.xmlparse.php is missing the closing "?>"

    Try adding one and see, it works for me.

    And as a prop to the origional code... other than this oversite and the Smarty error, the 091 release works "out of the box" for 076rc4a.

    --
    Under Construction!
  • Topiatic

    I actually just recently tore open this code in an effort to better integrate it with postnuke and remove it's smartification


    I'd be interested in sorting this module out too, although I'm a PHP virgin. I can see where some of the weakness of the code are, I'll probably prototype something up in perl and see if I can then re-write it in PHP. What does the Smarty bit do for you? What will you replace it with?
  • I was going to just replace the internal Smarty with pnrender calls instead. Figured I'd rebuild it from the outside in and just keep the functionality asis for now. We'll see how it works out, it's just a hobby for me 8).

    --
    Under Construction!
  • We'll I'd be happy to try and fix some of these annoying bugs. I'll have a hack tonight and see what I can cook up.
  • Awsome, just might have a functioning unit in a reasonable amount of time heh.

    personaly I only get one Smarty error ever and it's just writen to log, something about not being allowed to redeclare the length twice and that it's being ignored. As for the error mentioned above I've just likely not had the same set up as Wendell, but I have seen the code that asks for the non existant "utils" folder and it's likely you just have to change the path. I'll have another gander for it too.

    And did you try adding the closing

    Code

    ?>
    in the class.xmlparse.php file to address the formating/searching issues?

    Now back to trying to figure out were that dot is supposed to be...

    --
    Under Construction!
  • This is great news. I will try these fixes and let you know how it goes. I am also running PN 0.760 RC4a. :)
  • @Wendel

    The declaration function is (as your error report erronously reported) on line 1829 of the file /modules/phpbible/smarty/pbSmarty_Compiler.class.php.

    Code

    /**
     * compare to values by their string length
     *
     * @access private
     * @param string $a
     * @param string $b
     */

    function _smarty_sort_length($a, $b)
    {
        if($a == $b)
            return 0;

        if(strlen($a) == strlen($b))
            return ($a > $b) ? -1 : 1;

        return (strlen($a) > strlen($b)) ? -1 : 1;
    }


    I have successfully commented out the function and tested all I could think of with no noticable repercutions.

    The false path comes fromline 267 in /modules/phpbible/phpbible.postnuke.php

    Code

    /**
         * Get Smarty Templating Engine object
         */

        function getSmarty()
        {
            if (empty($this->smarty_dir)) {
                require_once "utils/smarty/Smarty.class.php";
            } else {
                require "$this->smarty_dir/Smarty.class.php";
            }

            // create smarty object
            $smarty = new Smarty();

            // configure Smarty variables
            $smarty->template_dir = "$this->lib_dir/templates";
            $smarty->compile_dir = "$this->lib_dir/utils/smarty/templates_c";
            $smarty->config_dir = "$this->lib_dir/langs/$this->userlang";
            $smarty->use_sub_dirs = false;

            return $smarty;

        } // getSmarty

    I have not commented out the line since it is obviosly called by something somewere. But, I can't imagine it would hurt to change what it reads since it obviously never uses it being as it does not exist (I have serached every package AND the cvs at sourceforge back to the origional pnBible release).

    I am finding this module to be incredibly conveluted with little more than translation proccesses to enable it in any CMS and that's cousing occasional problems... i can't wait to get rid of the padding.

    Hope that was helpfull.

    --
    Under Construction!
  • I've re-written the main OSIS parser to use xml_parse rather than the jumble of RE matches. This is standalone PHP code, it should be straightforward to integrate it. There may need to changes in the XML translation to HTML end of things, I'm less certain of this code. I'll plough on with it, it's interesting learning another language this way.
  • Nice! My own schedule hasn't allowed me to do much lately other than work that pays, but I'd be interested in seeing what you've done once your done. This is all a foriegn language to me heh.

    --
    Under Construction!
  • It finally works but the code looks lousy. I'll give it a bit of a tidy up and let you have a try.

Go to page 1 - 2 [+1]:

This list is based on users active over the last 60 minutes.