PHP includes in local dev
  • What's the procedure here? Is there any way to use include(), require() etc. to include local files rather than the ones on the server?

  • 7 Answers sorted by
  • ^ someone get on this pronto!

  • Hey guys,

    This was something we never planned for when developing vae_local. It was really meant as a VaeML development tool.

    I'd be willing to give a shot at improving this.

    My solution is probably going to be to create a new function called vae_include(), which will be a vae_local-compatible method of including PHP scripts. Is there any reason this wouldn't be good enough for you?

    Kevin

  • That sounds totally fine to me. We really want to get going on 100% local/svn setup. This is the last hitch.

  • I rolled out an update that provides the following new functions:

    vae_include()
    vae_include_once()
    vae_require()
    vae_require_once()

    These functions are aware of the local development environment and should work as you imagine they would.

    They are slightly different from PHP semantics in that paths should be specified relative to the document root, even if the current file is in a subfolder.

    For example:

    vae_include("lib/php/whatever.php");

    I haven't tested this on crazy setups, but it's working for me on basic test cases. If you run into any issues, let me know and we'll work through them.

  • Looks like this is confirmed to be working. Enjoy.

  • Awesome, thanks Kevin. So far so good!

  • Can you guys add these functions to the PHP documentation please?

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

In this Discussion