Random banner for wordpress - problem php include

Hello,

To get a random banner on my wordpress blog, I use a heading.php file as nicely provided by Bert Simmons on this post : http://www.zenphoto.org/support/topic.php?id=2639.

It worked like a charm... until my ISP (providing web space) has restricted php include function usage. Basically, having the heading.php file in my zenphoto theme direcotry, I add the following to my wordpress header.php:

<?php include("http://pascal.ledisque.free.fr/gallery/?p=heading"); ?>

Now it does not work anymore (access denied message). I am told to use relative path for such function, but I believe this is not possible here, as I must use http protocol.

Am I right ?
Do you see another way to achieve that ?

Note I understand this is not a zenphoto issue at all.. just trying to get my nice random banner back...

Thanks

Comments

  • Includes need to be filesystem paths, not WEB URLs. so figure out what the real file path is and use that.
  • pled Member
    I did a lot of tests without success : I am now sure the path is good (using getcwd() and file_exists(), and here are the results (on my local desktop, where I have no permission issue) :

    So the following works :
    `<?php include ("http://127.0.0.1/wordpress/zenphoto/?p=heading") ?>`

    If I use the following :
    `<?php include ("./zenphoto/themes/zenpage-default/?p=heading") ?>`

    => I get the following error : "failed to open stream: No such file or directory"

    But if I use :
    `<?php include ("./zenphoto/themes/zenpage-default/heading.php") ?>`

    => then I get : "Call to undefined function getRandomImages()"

    So I tried to add the following without success :

    `

    <?php<br />
    define('ZENFOLDER', 'zp-core');

    define('WEBPATH', 'http://127.0.0.1/wordpress/zenphoto');

    require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");

    ?>

    `

    So I conclude the path is good. But I have no idea why the relative path does not work.

    If someone has an idea how to make this works using relative path, that would be great !
  • acrylian Administrator, Developer
    We call the last you tried the "Zenphoto as a plugin" way. Sadly it simply does not work anymore with current Wordpress versions (which is noted on the user guide page for it btw). Wordpress changed the way how its theme files are loaded. We had a thread about that a while back, too.

    If heading.php is a custom theme page the links are wrong anyway. Please review the theming tutorial on custom pages.
Sign In or Register to comment.