php include in pages.php

How do I get for example `<?php include "404.php"; ?>` in a new page (like http://example.com/pages/test)? I put the code in "Codeblocks" but it doesn't seem to prosess the include command. echo ect. works though.

Comments

  • acrylian Administrator, Developer
    Do you try to incldue the standard 404 page? If why? Its already a page if its own. Besides the syntax is wrong `include("404.php")`.
  • It was just to test because I want to include something else. But it doesn't work with the right syntax either. I've put `<?php include ("404.php"); ?>` in Codeblock 1.

    Edit: What I really want to do is to use this code `<?php include dirname(__FILE__) . "/ccmail/include.php"; ?>` /ccmail/include.php is in the theme folder.
  • acrylian Administrator, Developer
    This can't work as the 404.php page is a full theme page that needs to be called via "page/404" or "index.php?p=404" to work correctly. Besides that it is an error page that does show nothing if there is no error...

    Also including complete pages into another one will lead to heavy validation issues...

    Try a snippet as the sidebar.php in the zenpage-default theme.
  • acrylian Administrator, Developer
    To your edit: You again did not use the brackets. Besides if it is in the theme you can include it using `$_zp_themeroot`/ variable. (see zenpage-default theme's css calls).
  • Like this? `<?php include (dirname(__FILE__) . $_zp_themeroot/."ccmail/include.php"); ?>`
  • acrylian Administrator, Developer
    You don't need the `dirname(__FILE__)`
  • Oh, it's for a php script in include.php. `<?php include ($_zp_themeroot/."ccmail/test.html"); ?>` doesn't work either though.
  • acrylian Administrator, Developer
    I don't know what it is you are trying to include so you will have to figure out that yourself, especially since it is not really Zenphoto related.
  • As long as the include is in one of your theme pages, you don't need to include the $_zp_themeroot variable. You should be able to reference it directly from the theme already. Removing that should make it easier to figure out.
Sign In or Register to comment.