Quote from: OpenGeek at May 13, 2011, 07:43 AM
You need to provide more information about what you are precisely doing or it’s not going to be possible to help...
Below are the shortened version of codes for the component,
each resource is flagged as published, since the file_get_contents was not working otherwise
$resources = $modx->getCollection('modResource',$c);
foreach ($resources as $resource) {
$resource->set('published','1');
$resource->save();
}
Loop through the resources
$resources1 = $modx->getCollection('modResource',$c1);
$table = $modx->getFullTableName("site_content");
foreach ($resources1 as $resource1) {
$parent_alias = $modx->db->getValue('SELECT alias FROM '.$table.' WHERE id='.$resource1->get('parent'));
$output = $output.CreateHTMLFile_2($modx->makeUrl($resource1->get('id'),null,null,'full'), $resource1->get('alias'), $parent_alias, $resource1->get('isfolder'));
$resource1->set('published','0');
$resource1->save();
}
and the function to get the html code and save it into a file.
function CreateHTMLFile($url, $alias, $parent_alias, $isfolder){
$output = '';
$content = file_get_contents($url);
if ($isfolder == '1') {
$filepath= $alias."/".$alias.".html";
}
else{
$filepath= $parent_alias."/".$alias.".html";
}
$FileName = "/var/www/html/ab/zona/kmc/".$filepath;
$FileHandle = fopen($FileName, 'w') or die("can't open file");
fwrite($FileHandle, $content);
fclose($FileHandle);
$output =$output."--".$alias."--".$url."-Content length:".strlen($content)."******";
return $output;
}
Let me know if anything else I can provide.