Fork me on GitHub

books & enclyclopedia modules and pntitle  Bottom

  • hello,

    Pntitle is a great little addition but I have been unable to get it work with books at all with:

    Code

    function books_title()
    {
        $bkid = pnVarCleanFromInput('bkid');
        $catid = pnVarCleanFromInput('cid');

        list($dbconn) = pnDBGetConn();
        $pntable = pnDBGetTables();
       
        if ($catid) {
            $result = $dbconn->Execute("SELECT title
                                        FROM $pntable[books_categories]
                                        WHERE cid ='"
    . (int)pnVarPrepForStore($catid) . "'");
            if ($dbconn->ErrorNo() != 0) {
                return false;
            }
            list($title) = $result->fields;
            $result->Close();
            return pnConfigGetVar('sitename') . ' :: '.pnVarPrepForDisplay($title);    
        }
             
        if ($bkid) {
            $result = $dbconn->Execute("SELECT title
                                        FROM $pntable[books_books]
                                        WHERE bkid ='"
    . (int)pnVarPrepForStore($bkid) . "'");
            if ($dbconn->ErrorNo() != 0) {
                return false;
            }
            list($title) = $result->fields;
            $result->Close();
            return pnConfigGetVar('sitename') . ' :: '.pnVarPrepForDisplay($title);
        }

        return pnConfigGetVar('sitename') . ' :: '. _BOOKS;

    }


    and for the encyclopedia I made a few changes to get it to work by adding 'PN' where needed (changed the cvs edition from sourceforge):

    Code

    function pnEncyclopedia_title()
    {
        $vid = pnVarCleanFromInput('vid');
        $letter = pnVarCleanFromInput('letterget');
        $id = pnVarCleanFromInput('id');
        $term = pnVarCleanFromInput('term');

            list($dbconn) = pnDBGetConn();
            $pntable = pnDBGetTables();

        // default
        $title = '';

        if ($vid) {
                $volumecolumn = $pntable[pnEncyclopedia_volumes_column];
            $sql = "SELECT $volumecolumn[volume] FROM $pntable[pnEncyclopedia_volumes] WHERE $volumecolumn[vid] = '" . (int)pnVarPrepForStore($vid) . "'";

            $result = $dbconn->Execute($sql);
            if ($dbconn->ErrorNo() != 0) {
                return false;
            }
                list($volname) = $result->fields;
                $result->Close();
                $title .= ' - ' . $volname ;    
        }

        if ($id) {
                $encyclopediacolumn = $pntable['pnEncyclopedia_column'];
                $sql = "SELECT $encyclopediacolumn[term] FROM $pntable[pnEncyclopedia] WHERE $encyclopediacolumn[id] = '" . (int)pnVarPrepForStore($id) . "'";

                $result = $dbconn->Execute($sql);
                if ($dbconn->ErrorNo() != 0) {
                    return false;
                }
            list($term) = $result->fields;
            $result->Close();
                $title .= ' - ' . $term;    
        } else {
            if ($term) { $title .= ' - ' . $term; }
            if ($letter) { $title .= ' - ' . $letter; }
        }
        if ($title !='' ) {
            return pnConfigGetVar('sitename') . ' :: '. $title;
        } else {
            return pnConfigGetVar('sitename') . ' :: Encyclopedia';
        }
    }
    ?>


    Where am I going wrong on the books? The only title working is the 'books' title for the main page:
    http://www.canadiandemocraticmovement.ca/books.html

    None of the catagories work - and how to include the individual book title?

    --
    WIRE SERVICE

    Free Press Releases
  • Hello,
    I seem to rememeber that the pntitle file for books Joerg Napp put in books CVS is mine. I will check it and send an updated one to Joerg if needed
    Here is the one I actually use (and it's working !!) on http://www.vedrine.net
    As you can see I had so many problems using books pntable that I gave up and used the old prefix trick. Not very neat but at least it works !!

    Code

    function books_title()
    {
        $bkid = pnVarCleanFromInput('bkid');
        $catid = pnVarCleanFromInput('cid');

        list($dbconn) = pnDBGetConn();
        $pntable = pnDBGetTables();
        $bookprefix = pnConfigGetVar('prefix');
       
        if ($catid) {
            $sql = "SELECT title FROM {$bookprefix}_books_categories  WHERE cid = '" . pnVarPrepForStore($catid) . "'";
            $result = $dbconn->Execute($sql);
            if ($dbconn->ErrorNo() != 0) {
                return false;
            }
            list($title) = $result->fields;
            $result->Close();
            return pnConfigGetVar('sitename') . ' :: '.pnVarPrepForDisplay($title);    
        }
             
        if ($bkid) {
            $sql = "SELECT title FROM {$bookprefix}_books_books WHERE bkid = '" . pnVarPrepForStore($bkid) . "'";
            $result = $dbconn->Execute($sql);
            if ($dbconn->ErrorNo() != 0) {
                return false;
            }
            list($title) = $result->fields;
            $result->Close();
            $title = str_replace('&', '&', pnVarPrepForDisplay($title));
            return pnConfigGetVar('sitename') . ' :: '. $title;
        }

        return pnConfigGetVar('sitename') . ' :: '. _BOOKS;

    }


    --
    Visit my live reef aquarium.

    My Amazon wish list.
  • Well I looked in pntitle CVS and I'm also the author of the Encyclopedia file icon_redface . I forgot everything about this one because I don't actually use this module, I made it for someone else who needed it. So I need to install again Encyclopedia on a test site in order to see what is wrong.
    But aparently in the version (wich is a rather old one but it was the module someone needed a pntitle file for) I used, tables were named 'encyclopedia' and in yours they are named 'pnEncyclopedia'. Can you point me to a download site for your version of this module (maybe it's 2 distincts modules in fact ??).

    --
    Visit my live reef aquarium.

    My Amazon wish list.
  • There is actually a module named Encyclopedia (http://orodruin.rivkashome.com/) as well as pnEncyclopedia (http://sourceforge.n…cts/pnencyclopedia/) overall their funcionality seems almost identicle at first glance. I know I use the Encyclopedia mod but was not able to get a title working quite right on there (http://www.hideyhole…yclopedia&func=main) but have not had the time to find the trouble with it.

    Take care,
    Michael
  • Hello, I looked at the pnEncyclopedia module and you function for pnEncyclopedia is working but you should change the line :

    Code

    $letter = pnVarCleanFromInput('letterget');

    to :

    Code

    $letter = pnVarCleanFromInput('get_letter');

    For ferretlover please can you try the file from the CVS here : http://cvs.sourcefor…dules/Encyclopedia/ because I think it works, your page looks as if you echoed the whole function as title.

    --
    Visit my live reef aquarium.

    My Amazon wish list.
  • Thank you both very much. jmvedrine you saved us from a headache and a few wasted hours.

    The books pntitle works great and does display the individual book title.

    Merci encore de votre travail dur.

    --
    WIRE SERVICE

    Free Press Releases
  • that one at the CVS worked like a charm for me. Thank you! Some time I hope to tackle some of the larger pntitle files I will need, like Coppermine for CMS. It is kind of a scarey thought, but it will need done.

    Take Care,
    Michael

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