Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Blocks
Author Message
draxx
Involved
Involved



Joined: Nov 19, 2003
Posts: 282

PostPosted: Sun Apr 19, 2009 6:12 pm Reply with quote

<?php

if ( !defined('BLOCK_FILE') ) {
Header('Location: ../index.php');
die();
}
$totalleads= 1;

mt_srand((double)microtime()*1000000);
$number = mt_rand(1,($totalleads-0));

$lead = include('blocks/leads/' . $number . '.html');

$content = " $lead content here <br/>";
$content .= " include('blocks/leads/' . $number . '.html'); ";


I want $lead to equal the content of the file 1.html.
In this case its an html img and link.
 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sun Apr 19, 2009 10:27 pm Reply with quote

draxx wrote:
<?php

if ( !defined('BLOCK_FILE') ) {
Header('Location: ../index.php');
die();
}
$totalleads= 1;

mt_srand((double)microtime()*1000000);
$number = mt_rand(1,($totalleads-0));

$lead = include('blocks/leads/' . $number . '.html');

$content = " $lead content here <br/>";
$content .= " include('blocks/leads/' . $number . '.html'); ";


I want $lead to equal the content of the file 1.html.
In this case its an html img and link.


Try
$lead = file_get_contents('blocks/leads/' . $number . '.html');
$content .= $lead
 
View user's profile Send private message
draxx







PostPosted: Sun Apr 19, 2009 10:57 pm Reply with quote

I had used this:
ob_start();
include('blocks/leads/' . $number . '.html');
$leadin = ob_get_clean();

But yours works as well and I have a feeling yours is more efficient as the first way is creating a buffer and yours is not Wink

Thanks my good man! Smile Smile
 
Raven







PostPosted: Sun Apr 19, 2009 11:11 pm Reply with quote

RavensScripts
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Blocks

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©