• Resolved eamonncoyne

    (@eamonncoyne)


    Hi,

    I am a new user of Code Snippets as before I was using My Custom Functions (which was working flawlessly but has been removed from www.ads-software.com)

    When using a snippet containing the following type of code:

    include_once(dirname(__FILE__) . '/../../../../themes/stockholm/dynamic_page/dbconnect_well.php');

    I am getting an warning error showing the following where the path to the plugin is being added to the above path

    Warning: include_once(/home/wellsfor/public_html/wp-content/plugins/code-snippets/php/../../../../themes/stockholm/dynamic_page/dbconnect_well.php): failed to open stream: No such file or directory in /home/wellsfor/public_html/wp-content/plugins/code-snippets/php/snippet-ops.php(505) : eval()'d code on line 4

    Hopefully someone can help with this as for the short term I have had to deactivate the snippet and add to functions.php instead

    Thanks

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    Welcome to the plugin!

    I recommend using absolute paths when loading files whenever possible.

    Something like this should work much better:

    include_once get_theme_root( 'stockholm' ) . '/dynamic_page/dbconnect_well.php';

    Thread Starter eamonncoyne

    (@eamonncoyne)

    Hi,
    Didn’t work as was but I added the name of the theme to the path instead and it worked.
    Thanks,
    éamonn

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘using url in code’ is closed to new replies.