How to use include(); in codeblock ?

Hello! I'm trying to use the include(); function in the page codeblock, but I'm getting a php error "failed to open stream: No such file or directory". The same code works fine if I type it directly in pages.php. Is there something I'm missing? Thanks!

`<?php include("something.php"); ?>`

I could use an if statement in pages.php to print the included code only in my desired page, but I think that's nasty coding.

Comments

  • p.s. Is there a similar variable for uploaded folder?
    `<?php echo $_zp_themeroot; ?>`
  • acrylian Administrator, Developer
    If you want a specific page layouted specifially you should look at the multiple_layouts plugin. (I don't think using an if statement would be nasty coding, I do that all the time on our own site but that is partly from times before said plugin existed).
  • You will probably have to use the fully qualified path to the script. Includes like you show are relative to the "current" folder. For codeblocks it is problematical to know what the current folder might be.

    There are defines for the various Zenphoto folders. See golbal-definitions.php.
Sign In or Register to comment.