Using PHP require in a content article with Joomla 3.0 Sourcerer plugin

I am trying to require the Simple HTML DOM Parser code snippet in a Joomla 3.0 content article using the Sourcerer Plugin, but instead the entire page fails to display with HTTP Error 500.

require “JPATH_ROOT.DIRECTORY_SEPERATOR.‘includes’.DIRECTORY_SEPERATOR.‘simplehtmldom_1_5’.DIRECTORY_SEPERATOR.‘simple_dom_parser.php’”;

What do I need to do to make this work?

It worked with the completely absolute path:

“/home/vol6_2/epizy.com/epiz_XXXXXXXX/htdocs/joomla30/includes/simplehtmldom_1_5/simple_html_dom.php”;

@InfiniteCustomer said:
I am trying to require the Simple HTML DOM Parser code snippet in a Joomla 3.0 content article using the Sourcerer Plugin, but instead the entire page fails to display with HTTP Error 500.

require “JPATH_ROOT.DIRECTORY_SEPERATOR.‘includes’.DIRECTORY_SEPERATOR.‘simplehtmldom_1_5’.DIRECTORY_SEPERATOR.‘simple_dom_parser.php’”;

What do I need to do to make this work?

I think you need to remove the surrounding double quotes. So instead of this:

require "JPATH_ROOT.DIRECTORY_SEPERATOR.'includes'.DIRECTORY_SEPERATOR.'simplehtmldom_1_5'.DIRECTORY_SEPERATOR.'simple_dom_parser.php'";

it should be

require JPATH_ROOT.DIRECTORY_SEPERATOR.'includes'.DIRECTORY_SEPERATOR.'simplehtmldom_1_5'.DIRECTORY_SEPERATOR.'simple_dom_parser.php';

I suspect that JPATH_ROOT is a constant which is set to the main folder of your website. If you do require JPATH_ROOT, it will try to load whatever file is at the variable JPATH_ROOT. If you do require "JPATH_ROOT", it will try to look for a file specifically called JPATH_ROOT.

Edit: heh, even the syntax highlighting in the forum know it’s different.