Page codeblock php include

In a page I am trying to activate PHPSlideshow.php by using the code

<?php include ('albums/phpslideshow.php?directory=Favorites'); ?>

which isn't working because I've probably forgotten something simple. The action does not seem to be tracing the intended path, for I receive the following error message:

Warning: include(albums/phpslideshow.php?directory=Favorites) [function.include]: failed to open stream: No such file or directory in /home2/rohairco/public_html/rogallery/zp-core/template-functions.php(4695) : eval()'d code on line 1

If anyone has some direction for me, that would be much appreciated. Thank you for such a wonderful project, and excellent support.

Comments

  • acrylian Administrator, Developer
    Sorry, I have no idea what "phpslideshow.php" is actually. For sure nothing by us.
  • I am sorry for not being more clear. The main question is how to use pages codeblocks to call a php include. I used phpslideshow.php as an example, because that's what I'm trying to incorporate. As a test, using <?php include ('sidebar.php'); ?> in the page codeblock, I get the same error previously mentioned.

    What I would like to receive some direction on is how to properly use the codeblock to call a .php file in the Page. (In this case, to have a slideshow play in the Page).

    Thank you.
  • Your use of the codeblock is correct. But what you are putting in the codeblock is most likely not correct.

    In your case it more likely may be that the path to your file is not being interpreted correctly. Again because the eval'ed code may not be happening where you expect. Codeblock evals occur within the template-functions.php script (printCodeblock(). That function will be called from somewhere in your theme.

    You should make the path absolute rather than relative ones so that the path is valid no matter what script invokes the eval.

    Note that there may be other problems once you get the script loaded. Noteably global variables will not be global as all this happens within a function call.

    An alternative approach is to create a function that does what you want. Have your theme load the script which contains the function then place a function call within the codeblock. It will be much easier to debug that way--you just call the function directly in a test script.
  • Thank you.
Sign In or Register to comment.