Skip to:
Content
Pages
Categories
Search
Top
Bottom

PHP Warning: include(../../ for plugin files

  • @hatter

    Member

    This is meant as a solution to a common issue when including template files within plugin files.

    Some plugins use their own files for outputting information to the browser. Usually, the instructions will tell you to modify the file to include files within the template you are using. I have found that most people will simply include, or require the file needed using a relative path, such as “../../bb-templates/kakumei/top-div.php”. Usually this is fine, unless the plugin file is called in such a way that the relative path doesn’t work. The best way around this is to use the function bb_get_template, which will get the file as an absolute path, using the current template, if applicable, or the default template if necessary. An example of this would be:

    include(bb_get_template(“top-div.php”));

    Hope this helps.

  • You must be logged in to reply to this topic.
Skip to toolbar