Need Help getting PHP Gallery working in Wordpress

I am replacing an existing Dreamweaver site at the same URL with a new site based on WordPress. The old site has a PHP driven photo gallery that I want to include in the new site.

I have the photo gallery installed in the main route of the site. I’ve installed WordPress to a folder within www called “WordPress” with the WordPress index file within that folder. I will move the index and .htaccess files to the WWW folder when the site is ready to go live.

The problem is that I am trying to get the existing photo galleries installed on the new WordPress pages and I am getting errors. I have tried various path options in the PHP and keep getting errors.

The PHP - which works on the Dreamweaver version of the site is:
[php]<?php $cat='3';include('photogallery/mainpage.php')?> [/php]

With this code in the WordPress page I get the following error messages:

Warning: include(photogallery/mainpage.php) [function.include]: failed to open stream: No such file or directory in /home/atmosphe/public_html/wordpress/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 1
Warning: include(photogallery/mainpage.php) [function.include]: failed to open stream: No such file or directory in /home/atmosphe/public_html/wordpress/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 1
Warning: include() [function.include]: Failed opening ‘photogallery/mainpage.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/atmosphe/public_html/wordpress/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 1

I was instructed by one source to try this:
[php]<?php $cat='3';include('/home/atmosphe/public_html/photogallery/mainpage.php') ?>[/php]
But that generates this error:
“Fatal error: Function name must be a string in /home/atmosphe/public_html/photogallery/mainpage.php(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code on line 2”

I really hope someone can help,
Thanks
John

You’re missing the trailing semi-colon at the end of your “include”:

[php]<?php
$cat=‘3’;
include(‘photogallery/mainpage.php’);

//actually should be: include ‘photogallery/mainpage.php’; without the ‘(’ and ‘)’
?> [/php]

Thanks for the reply. I think I did what you said. I changed the PHP to:
[php]<?php $cat='3';include;'/home/atmosphe/public_html/photogallery/mainpage.php'?> [/php]
Which resulted in the following error:

Parse error: syntax error, unexpected ‘;’ in /home/atmosphe/public_html/wordpress/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 1

Did I do it incorrectly?

In case I misread the instructions - which I probably did since it’s not working, I tried this as well:
[php]<?php $cat='3';include;'photogallery/mainpage.php'?> [/php]
Which resulted in these errors.

Warning: include(photogallery/mainpage.php) [function.include]: failed to open stream: No such file or directory in /home/atmosphe/public_html/wordpress/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 1

Warning: include(photogallery/mainpage.php) [function.include]: failed to open stream: No such file or directory in /home/atmosphe/public_html/wordpress/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 1

Warning: include() [function.include]: Failed opening ‘photogallery/mainpage.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/atmosphe/public_html/wordpress/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 1

Could this be being caused by the index and .htaccess files being temporarily inside the wordpress file and not in the site root?

Sponsor our Newsletter | Privacy Policy | Terms of Service