Not signed in (Sign In)

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

    • CommentAuthorkokuda
    • CommentTimeJun 6th 2008
     
    I've been playing around with making my own theme for Plogger before I go live on my site, and I am integrating into a wordpress site so I want it to inherit the look of my Wordpress theme.

    One thing that struck me is that the themes in Plogger do, by default, do not control all the output. Specifically, the index.php contains the html/DOCTYPE/head/body/tags and the theme is only allowed to add data inside the body.

    I even found some tutorials online about merging a Plogger theme with wordpress themes, but they involved editing index.php to make it a copy of your wordpress theme. I did a little digging and found what I think is a better way, but it moves more of the tags into the theme.

    What I have done is effectively strip index.php down to this (comments removed)...

    index.php
    require("gallery.php");
    the_gallery();


    The I leave it up to the theme header.php and footer.php to include all the header and footer bits. To show what I mean, this is how I changed the default theme. I added the following to the top of the file.

    header.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_gallery_head(); ?>
    </head>
    <body>


    and added the following to the bottom of footer.php

    footer.php
    </body>
    </html>


    The advantage of this is that it allows the theme to be so flexible as to not need to change the index.php just because you want to do some crazy stuff. For example.

    This is what I added to the top of header.php in my theme to get the wordpress header.

    header.php
    // Add a Wordpress wp_head action that prints out the Plogger <head> code.
    function wp_plogger_head() {
    echo the_gallery_head();
    }
    add_action('wp_head', 'wp_plogger_head');

    // Print the Wordpress header.
    get_header();


    With that and a minor change to the bottom of footer.php I now have a plogger theme that is not only contained within my wordpress theme look, but could work for any wordpress theme (though there may be formatting issues). This means that if I change my wordpress theme or my Plogger theme (if Plogger had the changes I desire) then the site would still mostly work.

    footer.php
    // The Wordpress footer
    get_footer();


    Fortunately for me, this also means that I can still switch my Plogger gallery back to the default theme any time I want.
    Unfortunately, it means that I have to make minor changes to any Plogger themes that I want to try out because this is not the standard.

    Thoughts?

    * Note, the one thing missing from all this is where I had to include the wordpress code "wp-blog-header.php". Unfortunately, if I include it after gallery.php (like in header.php) then I get strange undefined references errors, but if I include it before then it works without problems. So I currently have to include it at the top of index.php, but that is a side effect of me being to lazy to figure out what the real problem is and doesn't take away from the fact that this is still an interesting change.
    •  
      CommentAuthorsidtheduck
    • CommentTimeJun 6th 2008 edited
     
    kokuda,

    It sounds like you are really getting into the theme making! I can't wait to see your integration at the end!

    It seems like you will have successfully integrated your Wordpress theme into your Plogger install by the time you are done. However, the rest of the themes are set up the other way around, trying to integrate Plogger into the existing theme / template of the rest of the site. That is why a lot of the wrapping HTML code is located within the 'index.php' file. The way Plogger is currently set up, you would include the Plogger code into a template file of your own system.

    It used to work like that with anti's Wordpress plugin as well, Plogger could be inserted into the body of a Wordpress post. However, with the internationalization of Plogger (>=3.2 unreleased) and the release of Wordpress 2.5, the plugin no longer works as conflicts are raised between the two programs. We are working on trying to get this to integrate as easily as possible, but it isn't working as of this post.

    So, to sum up, I like what you are doing. Unfortunately, I don't think it will change how the themes are set up as not everyone is integrating Plogger with Wordpress (although some definitely are).
    These are just my personal thoughts too, so please feel free to let me know your thoughts as well. :D
  1.  
    The use of index.php is not required. My current setup uses plogger in another folder with another file (per my other posts). I have some authentication code and other things going on, and some custom menu items on the page that creates my gallery. A standard theme could be used without modification (although I did customize mine as well). So, you can do this without touching the index.php file, nor modifying the themes.

    So, you might just create a file called, "wordpress-plog.php" and use that, and put your modifications in that file.
    • CommentAuthorkokuda
    • CommentTimeJun 8th 2008
     
    I understand that the model of replacing index.php with something else has been used many times in the past. I was actually just doing this myself at one point (I put all the wordpress specific bits in index.php and not in the theme). That is a good way to build a wordpress plugin that embeds plogger in a page. That allows any theme to possibly work without modification. I get it.

    The main reason why I didn't "love" that model was that it makes it hard to have specific theme pages not use the the code in index.php (in my case, the Wordpress header). At one point I was showing photos at full size in picture.php and that didn't fit within my Wordpress framework, so I disabled it for that one page. If the Wordpress header was included in my "index.php" then it would be very difficult to disable it from the theme since the header is included before any of the theme code is executed. My change effectively makes all "output" to be inside each theme page (picture.php includes header.php which eventually includes head.php). With the original dependency of (index.php includes head.php and picture.php which includes header.php) it is harder (impossible?).

    It isn't a big deal either way at this point. I have found a way to use my theme consistently so I don't need that behaviour, but it would have been handy at one point.

    I guess it comes down to "are you including plogger in another framework or another framework in plogger?" I was thinking that the Plogger theme should define how the entire page looks but I guess it is designed to define only how the Plogger gallery looks regardless of where it exists. I'll buy that.