Forum Moderators: coopster
I'm trying to write this code to a index.php file when i generate directories on my site,
like:
PHP Code:
fwrite($handle, "
<?
$file = file('http://www.somesite.com/?page=sublist&cat=$row[cid]');
foreach($file as $line){
echo $line;
}
?>
");
fclose($handle);
which seems to kind of work, but it takes some of the code out and leaves me with this inside the index.php file:
<?
= file('http://www.sometime.com/?page=sublist&cat=1');
foreach( as ){
echo ;
}
?>
seems to remove anything with a $ in front of it,
any ideas on how to get around this?
thanks in advance for your time!
-Ken
fwrite($handle, '
<?
$file = file(\'http://www.somesite.com/?page=sublist&cat=$row[cid]\');
foreach($file as $line){
echo $line;
}
?>
');
fclose($handle);
It seems as though you may actually want $row evaluated. In that case:
fwrite($handle, '
<?
$file = file(\'http://www.somesite.com/?page=sublist&cat=' . $row[cid] . '\');
foreach($file as $line){
echo $line;
}
?>
');
fclose($handle);
Should do it.
I think I got that right. PHP masters here know better than me. :)