|
Preview Release:
Enhanced Simple PHP Gallery v2.0
Integration into Wordpress: Before version 1.7 a lot of inline style was used in the gallery, by moving this to the head of the page it has reduced file size, but made integration into Wordpress slightly tougher, but by no means impossible.
The eSPG Downloads page now has a link to download some files to help with this. The zip contains 3 files which are a direct replacement fo the standard gallery template files. It contains:
[1] header.php, [2] footer.php, and [3] sp_styles.css
This is based on the standard Kubrick theme which is the default theme for Wordpress 1.5. I don't use this theme myself, so currently these are experimental and untested. However themes vary, and people will more than likely not use the default. So as a guide here is how my header and footer were amended to integrate into permanent tangent (long removed).
Amendments needed to the header.php template supplied with eSPG.
<?php
/* Don't remove this line. */
require('../wp-blog-header.php');
?>
Taken from my Wordpress Theme header :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<title><?php bloginfo('name'); ?><?php getPageTitle(); ?></title>
<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats please -->
<style type="text/css" media="screen">
@import url( <?php bloginfo('stylesheet_url'); ?> );
</style>
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php wp_get_archives('type=monthly& format=link'); ?>
<?php //comments_popup_script(); // off by default ?>
<?php wp_head(); ?>
Taken from the Gallery header.php :
<link rel="stylesheet" type="text/css" href="<?php getCurrentWorkingDirectory();?>/sp_styles.css" media="screen" />
<style type="text/css" media="screen">
<?php
// Add dynamic styles here
if($display_file == '')
{
$divwidth = $maxthumbwidth + 10;
$divheight = $maxthumbheight + 24;
if($showimgtitles)
$divheight += 16;
if($showdatesonthumbspage)
$divheight += 16;
echo "div.imgwrapper {n";
echo " width: " . $divwidth . "px;n height: " . $divheight . "px;n";
if($alignimages)
echo " text-align: center;n";
echo "}n";
}
else
{
echo "div#image {n";
echo " width: " . ($img_attr_width + 8) . "px;n";
echo " height: " . ($img_attr_height + 8) . "px;n";
echo "}n";
}
?>
</style>
<?php
//INSERT LINK ELEMENTS
// if($display_file != '')
if(!empty($display_file)){ //IF A FILE WAS REQUESTED FOR VIEWING, OUTPUT Prev & Next LINKS.
getPrevAndNextLink();
}
else //OTHERWISE, A DIRECTORY LISTING REQUEST WAS MADE; DISPLAY THE Start LINK.
{
if(empty($disablestart))
getStartLink();
} // END IF
//IF A FILE WAS REQUESTED FOR VIEWING, LINK TO IMAGE-FADE SCRIPT
if(!empty($display_file) && $image_fade_in)
{
?><script src="<?php getCurrentWorkingDirectory();?>/imagefade/imagefadein.js" type="text/javascript"></script>
<?php
}
?>
</head>
<body>
Taken from my Wordpress Theme header :
<div id="rap">
<div id="head">
<h1 id="header"><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></h1></div>
<div id="content">
Taken from the Gallery header.php :
<div id="espg">
<h2><?php getPageTitle(); ?></h2>
But remember this all depends on the theme you are using, no doubt yours will be different.
Amendments needed to the footer.php template supplied with eSPG.
<!-- begin footer -->
</div>
<div id="copyright">© Rich Pedley 2005</div>
</div>
<?php get_sidebar(); ?>
<p class="credit"><!--<?php echo $wpdb->num_queries; ?> queries. <?php timer_stop(1); ?> seconds. --> <cite><?php echo sprintf(__("Powered by <a href='http://wordpress.org' title='%s'><strong>WordPress</strong></a>"), __("Powered by WordPress, state-of-the-art semantic personal publishing platform.")); ?></cite></p>
</div>
<?php do_action('wp_footer'); ?>
</body>
</html>
As you can see there are really only two important additions, <?php get_sidebar(); ?> and <?php do_action('wp_footer'); ?>. Again this really depends on your theme.
The following should then be deleted from the standard sp_styles.css :
html {
background:#D1ECE8;
}
body{
font-family: arial,helvetica,sans-serif;
font-size:90%;
/*-moz-border-radius:20px;*/
margin:15px;
color:#666;
background:#fefefe;
border:1px solid #bbb;
}
It is then a matter of playing with the css to get things to work, although the majority of it should be fine
Good Luck!
|