PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
$site_title = "Official Website of the Invicta Dynamics";
$page_title = "Home of The Ladies Ice Hockey club for Kent South-East UK";
$main .= "<h2>Welcome to our Hockey site</h2>
<p>Glad you dropped by and hope you find our website an enjoyable and exciting experience! You've successfully found your way to our home page.</p>
<p> include ('../../plogger-1.0RC1/plog-content/plugins/random-images/random-images.php') </p>";
require('admin/template.php');
?>
The file i am trying to include is on line7. All works find except this section.
I am very new so may have to be basic with myself.
//start an ouput buffer
ob_start();
//include the file that outputs stuff - the buffer will catch this
include ('../../plogger-1.0RC1/plog-content/plugins/random-images/random-images.php');
//assign the contents of the buffer to a variable and delete and stop the buffer
$random_image = ob_get_clean();
$main .= "<h2>Welcome to our Hockey site</h2>
<p>Glad you dropped by and hope you find our website an enjoyable and exciting experience! You've successfully found your way to our home page.</p>
<p> $random_image </p>";
//use the var above
If you are going to do this a lot, then you might build a function:
function getFileOutput($file) {
ob_start();
include ($file);
return ob_get_clean();
}
$random_image = getFileOutput('../../plogger-1.0RC1/plog-content/plugins/random-images/random-images.php');
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.