Not signed in (Sign In)

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorphual
    • CommentTimeMay 3rd 2009
     
    After quite a bit of effort and some gratefully received help from others, I?ve finally managed to work out how to successfully integrate Textpattern and Plogger. What follow is information on what I did to achieve this ? partially in the hope that it?s of use to others, but also because I?m looking to benefit from others successes.

    The following guide starts out assuming that you have an installed version of Textpattern (in my case, v4.08) with cruft-free URLs turned on (for me, this was as ?/section/title?. It's copied from my post on Textpatterns forums, which is why some parts of it explain Plogger in a little more detail tan you lot need. I've also had to split it across multiple posts due to the size.

    A warning about conflicts

    Apart from one minor conflict that can easily be resolved as shown below, both Plogger and Textpattern use the ID variable to identify items. As such, an id intended for use in Plogger may give undesired results from Textpattern. My solution to this problem was simply to put the gallery in its own section and ensure that no articles were called. This in itself causes a problem, in that Textpattern returns an error if there is no tag used. I solved this by inserting a commented out article tag to my page like so:

    <!-- &lt;txp:article form=&quot;default&quot; limit=&quot;20&quot; /&gt; -->

    Download & Install Plogger

    Recent updates to the Plogger code is what has made this job that much easier, and these updates have not yet made it out of SVN. I downloaded revision 595 from http://svn.plogger.org/trunk using my SVN client. Sadly, one change does need to made to the code to prevent a conflict between identically named Textpattern and Plogger functions. However, this function is already obsolete and should be removed in revision 596 or 597.

    To remove this conflict, open file ?plog-includes/plog-funtions.php?, find the function ?getmicrotime? and comment it out (should be around line 403).

    I then installed the software normally in Textpattern?s root directory and opted to use the same database for Textpattern and Plogger (i.e. installed the Plogger tables in the existing Textpattern database).

    Fix htaccess for cruft-free URLs

    One of my requirements was to retain the cruft-free structure of Textpattern, and I managed to achieve this with a one-line hack to the htaccess file. Note that this hack only allows Textpattern to operate cruft-free. I?d like to get both Textpattern and Plogger to integrate as cruft-free, but haven?t managed it yet.

    A typical Txtpattern URL will rewrite /section/article_title to ?s=section&id=article_id

    A typical Plogger URL is ?level=album&id=album_id or ?level=collection&id=collection_id

    To get the two to work together, I created a section, named ?gallery? to contain the gallery. This section contains no articles to prevent conflicts between the Textpattern and Plogger variable, ?ID?, passed through the URL. The htaccess file then needs the line RewriteRule ^gallery/?$ /?s=gallery [QSA,L] adding so that the revised htaccess file looks something like this

    <IfModule mod_rewrite.c>
    RewriteEngine On
    #RewriteBase /relative/web/path/
    #
    RewriteRule ^gallery/?$ /?s=gallery [QSA,L]
    #
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^(.+) - [PT,L]
    #
    RewriteCond %{REQUEST_URI} !=/favicon.ico
    RewriteRule ^(.*) index.php
    #
    RewriteCond %{HTTP:Authorization} !^$
    RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
    </IfModule>
    • CommentAuthorphual
    • CommentTimeMay 3rd 2009
     
    Set up gallery section

    Plogger is designed to integrate into sites easily by inserting three lines of code;

    <?php require('plogger.php'); ?> at the start of the page
    <?php the_plogger_head(); ?> in the header, and
    <?php the_plogger_gallery(); ?> in the body.


    A simple Plogger page would then look something like this:

    <?php require('plogger.php'); ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xml:lang="<?php echo $language; ?>" lang="<?php echo $language; ?>" xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <?php the_plogger_head(); ?>
    </head>
    <body>
    <?php the_plogger_gallery(); ?>
    </body>
    </html>


    This separation of the code across three calls causes problems with Textpattern, as it will not execute code within the tag in the global scope (i.e. you can?t easily pass variables from one code block to another). Thankfully, all of the variables used are helpfully included in two arrays, which can be declared globally to make them available to the rest of the scripts. Your three lines of code then become:

    <txp:php>
    global $thumbnail_config;
    global $config;
    require("plogger.php");
    </txp:php>


    <txp:php>
    the_plogger_head();
    </txp:php>


    and

    <txp:php>
    global $config;
    global $thumbnail_config;
    the_plogger_gallery();
    </txp:php>


    and our example page becomes:

    <txp:php>
    global $thumbnail_config;
    global $config;
    require("plogger.php");
    </txp:php>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xml:lang="<?php echo $language; ?>" lang="<?php echo $language; ?>" xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <txp:php>
    the_plogger_head();
    </txp:php>
    </head>
    <body>
    <txp:php>
    global $config;
    global $thumbnail_config;
    the_plogger_gallery();
    </txp:php>
    </body>
    </html>


    Use?

    That?s it! You should be ready to start using the two programs together. Here is my attempt to show you what it looks like and how well it integrates with the rest of the site: www.astonnechellscofe.org.uk/gallery

    Stuart