I wanted to integrate Enhanced Simple PHP Gallery into Wordpress 1.5, but also have the ability to have the same gallery and not use wordpress. So that people can go directly to images.dreden.com and you will see eSPG without wordpress, but if you go to
images.dreden.com/wp_index.php you will see the gallery integrated into wordpress. The nice thing with this way is that you can change theme on the fly without editing any files. The way this is explained on the eSPG website uses header.php and footer.php files and it is based on the standard Kubrick theme. So the theme doesn’t change together with wordpress (correct me if i’m wrong here).
If this sounds interesting, read on and i’ll show you how i did it. Its really simple and fully themeable.
If you haven’t downloaded Enhanced Simple PHP Gallery 1.7 yet, you can download it here and install it.
What you want to do first is create a file called wp_index.php.
then
Cut and paste this code into the file wp_index.php:
<style type="text/css" media="screen">
PASTE STYLE HERE
</style>
<?php
/* Don’t remove this line. */
require(’/var/www/htdocs/wp-blog-header.php’);
?>
<?php get_header(); ?>
<div id="content" class="narrowcolumn">
<div class="navigation">
<div class="alignleft"><?php posts_nav_link(”,”,’« Previous Entries’) ?></div>
<div class="alignright"><?php posts_nav_link(”,’Next Entries »’,”) ?></div>
</div>
<div id="espg">
// Enhanced Simple PHP Gallery START
// Enhanced Simple PHP Gallery END
</div>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Now look at the line that says:
require(’/var/www/htdocs/wp-blog-header.php’);
and change /var/www/htdocs/wp-blog-header.php to /the/path/to/wp-blog-header.php. Just in case you misunderstood that you have to change it to the full path to the file wp-blog-header.php. In my case the file is in /var/www/htdocs.
Open the file sp_styles.css, select everything and paste it where it says “PASTE STYLE HERE”. The reason for this is so you can have a different styles in Wordpress and the standalone gallery.
Be sure to delete the text “PASTE STYLE HERE”!
Also remove this:
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;
}
from what you pasted from sp_styles.css
Open the file sp_index.php select everything and copy (CTRL-C) and paste (CTRL-V) in between:
// Enhanced Simple PHP Gallery END
Remove the line:
include(’header.php’);
somewhere at the top where this is:
require(’sp_config.php’);
require(’sp_helper_functions.php’);
require(’sp_def_vars.php’);
include(’header.php’);
and change:
to:
Also remove the line at the bottom that says:
Now copy the file sp_helper_functions.php to a new file called wp_helper_functions.php and change the line:
to:
in wp_helper_functions.php
Save the files in the same directory where all the Enhanced Simple PHP Gallery files are.
Thats it!
Here are examples of the finished files:
wp_index.php wp_helper_functions.php
I have prepared a ZIP file with the two finished files based on Enhanced PHP Gallery 1.7 here
If i have forgotten something, you have any questions or you can’t get it to work. You are welcome to leave a reply below.
Hello,
I have installed your script but keep getting the following error when uploading.
Warning: fopen(sp_descriptions.ini): failed to open stream: Permission denied in /home/******/public_html/gallery/sp_helper_functions.php on line 486
The images upload anyway, I can view the full size images, but the thumbs do not show.
When trying to edit any information, folders or subfolders, I get the following errors:
Warning: fopen(sp_descriptions.ini): failed to open stream: Permission denied in /home/jartbyme/public_html/gallery/sp_helper_functions.php on line 486
Warning: Cannot modify header information - headers already sent by (output started at /home/******/public_html/gallery/sp_helper_functions.php:486) in /home/******/public_html/gallery/header.php on line 2
Can you shed any light, please. Thanks in advance. Great work, by the way.
If you have your own server “chown nobody.nobody sp_descriptions.ini”,
if you uploaded via ftp and you do not own the server/are admin
“chmod 666 sp_descriptions.ini”. What this does is to make the file writable by the web server.
If you don`t know how to do this, look here
Did you remove the line:
include(’header.php’);
somewhere at the top of wp_index.php ?
chmod 666: check
include(’header.php’); removed : check
problem persists, plus when creating new subfolders:
/home/******/public_html/gallery//newsubfolder
Note the double slash preceding the new folder, accompanied by Permission denied in /home/******/public_html/gallery/sp_editor.php on line 238
I’m pretty sure that I saw the “double slash” issue at the SPG forums. I’ll have a browse there again. The other weird thing is that I had to delete the call for sidebar out of the wp_index, because it was being centered. As soon as I removed it, I am now getting the sidebar still, but it is in its propper position. So to sum up:
1. no thumbs
2. cannot create/edit via web, only via ftp or serverside
3. I’m really, really liking this more and more
P.S. I’m also trying to figure out how to remove the sidebar from the gallery index.
thanks again
Do you have these problems with sp_index.php also?
Dreden, these problems are specifically in ap_index.php, in other words in the gallery propper. I do not have any editing links or options in wp_index. Another strangeness, every other time at the sign in screen in gallery propper, I get Warning: Cannot modify header information - headers already sent by (output started at /home/******/public_html/gallery/validate.php:27) in /home/******/public_html/gallery/header.php on line 2. It still lets me sign in after that though. So to sum up, I can now upload files, edit folder info, but cannot create folders and cannot see thumbs. Thanks for getting rid of half the headache so far, dreden.
^oops, that first line was supposed to read sp_index, not ap_
open up gd_detect.php in the browser see what it says and make sure
$gd_version = ” “; at the bottom of sp_config.php contains the same version number
did that yesterday, dreden. $gd_version = “2.0.28″;
that doesn’t seem to be the culprit. I have also checked permissions on the cache and rcache folders, had them at 775, then 777.
The weirdness continues, because it seems that whatever changes I make to any file or folder permissions, the result is not instant, but seems to come after a while. I just went back and the image that I uploaded this morning is now showing up its thumb, while the other ones from yesterday do not. What I will do is re-upload the other images and wait and see what happens. I’ll pretend to go away and come back, since the server likes to play hide and seek with me it seems. LOL!
also, is there any easy way of getting rid of the sidebar in wp_index? I got rid of the call to sidebar, remember, but it is still pulling it from somewhere. Thanks again!
Remove the line that contains “get_sidebar()” at the bottom, but you already did that?
I just tested it and my sidebar was removed.
What server are you running this on ?
server is linux/apache with most popular modules
… and yes, I removed that line from wp_index, so I have no clue where it is being called from. I’m working with the daisyrae theme, but that shouldn’t really make a difference.
mmh…
I’m getting this weird error
Parse error: parse error, unexpected T_STRING in /home/flipthed/public_html/espg/wp_index.php on line 421
my 421 line is:
dunno…
ok dudes… I’ve figured it out: the code on this blog is wrong. I’ve used the right code in the PHPs files though… and now kinda works…
but I get these errors now:
Warning: main(rotator.php): failed to open stream: No such file or directory in /home/*****/public_html/espg/wp_index.php on line 414
Warning: main(rotator.php): failed to open stream: No such file or directory in /home/*****/public_html/espg/wp_index.php on line 414
Warning: main(): Failed opening ‘rotator.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/*****/public_html/espg/wp_index.php on line 414
what a dumbass… I don’t need a rotator.php…
see what happens when you code late at night???
Just a question… I am a beginner at PHP and am wondering where exactly I am supposed to put my edited files, and am I to upload them via FTP?
Bekah: You put them in the same directory as where your enhanced simple php gallery are. You can download it here
Flipthedolphin: doesn’t cause an error if rotator.php isn’t found. What do you mean, the code is wrong?
if you copy and paste the text on this post into a text file your get
but you should get
which is different in the “‘” things…
you can get the right code only if you watch the PHPs files.
oh damn…
I forgot those dummy “code” tags…
well… there is a slight difference between the code you reported here on you blog and the code that we can read in the phps files.
the phps files are correct. the code here is not.
the error is in the navigation divs: alignleft and alignright.
the “‘” are different and those on this post are wrong. Those in the phps file are correct.
I was afraid that would happen, i had some problems getting the code to display correctly on this page.
Please help me, i install eSGP, but, i need you eSGP Gallery without sidebar what use width 100%……
Tell me how i can make it please….
remove < ?php get_sidebar() ?> in wp_index.php
sorry by my poor english… i’am from CHILE, i speak spanish….
Ok, I did what you say to me, but it is not even to me…
Please, help me…
This is my page http://www.ligabc.dm.cl/portal/album/wp_index.php
Good job ! It helped me a lot ….
I get this error when i try to enter the wp_index.php-file:
In your tutorial you write the following:
I am not familiar to this way of writing a path. The header file I want to use has got this URL http://www.hoejlundcarlsen.dk/wp-content/themes/pool/header.php so what should I write in the wp_index.php file to make it recognize my header?
/usr/home/web/webxxxxx/wp-blog-header.php
hello there!
dreden could you tell me what the is the problem with my site.. I did everything you said in your tutorial but still I couldn’t figure it out…
here’s my site http://www.lvtair.com/gallery
im almost done but I have error
Parse error: parse error, unexpected T_STRING in /home/kiss/public_html/gallery/wp_index.php on line 419
below is the line 419
the page seem to be showing up nice at http://slacker.ph/blog/gallery1 but how to I pull it off my main page? http://slacker.ph/blog
ok nevermind figured it out stupid me… so you call wp_index.php
http://www.slacker.ph/blog/gallery1/
http://www.slacker.ph/blog/gallery1/ is working fine but http://www.slacker.ph/blog/gallery1/wp_index.php is all but plain lynx browser format
Have you edited the line that says:
require(’/var/www/htdocs/wp-blog-header.php’);
?
This needs to be set to the full path to the file wp-blog-header.php
yups done that i even added /home/my home directory here/public_html
hello there below is the line that has problem dunno what to do
i have no php background apprecaite all the help…
how could i fix it?
div id=”content” class=”narrowcolumn”>
div class=”navigation”>
div class=”alignleft”>
div class=”alignright”>
/div>
<div id=”content” class=”narrowcolumn”>
<div class=”navigation” >
<div class=”alignleft” > <?php posts_nav_link(”,”,’« Previous Entries’) ? > < /div >
<div class=”alignright” > < ?php posts_nav_link(”,’Next Entries »’,”) ? > < /div >
</div >
</div >
fix the ‘
Hello dreden. I have followed your instructions regarding implementing the enhanced gallery. But the gallerysite remains blanco. I have put the full serverpath for the wp-blog-heather file. And still nothing shows up. The normal gallery indexfile works but it would be great if you know what the promblem is why it stays blanco. When looking at the source code only the css-code is there. greetings MazAlien
Please, help me. i install wp_index.php, but i call wp_index.php, but not see the header the gallery is http://adictochile.pandela.net/galeria/wp_index.php and the web is http://adictochile.pandela.net…
Please help me…
Sir
I replaced
require(’/var/www/htdocs/wp-blog-header.php’)
with
require(’/home/termina/public_html/wordpress/wp-blog-header.php’)
and a couple of other tries and got the following errors:
Warning: Division by zero in /home/termina/public_html/gallery/wp_index.php on line 363
Warning: Division by zero in /home/termina/public_html/gallery/wp_index.php on line 363
Warning: main(0php�): failed to open stream: No such file or directory in /home/termina/public_html/gallery/wp_index.php on line 363
Warning: main(0php�): failed to open stream: No such file or directory in /home/termina/public_html/gallery/wp_index.php on line 363
Warning: main(0php�): failed to open stream: No such file or directory in /home/termina/public_html/gallery/wp_index.php on line 363
Fatal error: main(): Failed opening required ‘0php�’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/termina/public_html/gallery/wp_index.php on line 363
Line 363 is the line with require(’/var/www/htdocs/wp-blog-header.php’)
Any suggestions? Thanks.