I am writing a plugin that requires a large chunk of html. Now the way how it is set up now works.
return <<<EOT <html> EOT;
But I want to split the file into different php files that i can include. Now I tried this, but it does not work:
ob_start();
include(plugin_dir_url( __FILE__ ).'file.php');
return ob_get_clean();
Any know how this could be done?
=====================
EDIT
Ok thanks Chris Carson to I have found the small error, I changed the code to:
ob_start();
include(plugin_dir_path( __FILE__ ).'/file.php');
return ob_get_clean();
This is working ok now, except for one small problem.
In the previous code I used something like this:
$variable = 'Hello!';
return <<<EOT
<span>{$variable}</span>
EOT;
This would have made the following in html:
<span>Hello!</span>
But now this:
$variable = 'Hello!';
ob_start();
include(plugin_dir_path( __FILE__ ).'/file.php');
return ob_get_clean();
This just prints
<span>{$variable}</span>
Any way to get the code working with variables.
