Hello,
I am building a website from a huge amount of files that are generated from a shell script, I have found a way to insert the generated HTML pages into drupal by using the following code:
<?
function mySave($type, $title, $body)
{
$edit = array();
$edit['type'] = $type;
// get the node type defaults
$edit['uid'] = 1;
$edit['name'] = 'mathQuestion';
$edit['promote'] = 0;
$edit['comment'] = 0;
//$edit['revision'] = ;
$edit['format'] = FILTER_HTML_ESCAPE;
$edit['status'] = 1;
$edit['title'] = $title;
$edit['body'] = $body;
$edit['date'] = format_date(time(), 'custom', 'Y-m-d H:i:s O');
node_invoke_nodeapi($edit, $type);
node_validate($edit);
if ($errors = form_get_errors()) {
print_r($errors);
}
$node = node_submit($edit);
node_save($node);
}
include_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
if($_SERVER['argc'] != 4)
{
echo "Expected 3 arguments: FileName,Question,PageNumber\n";
die();
}
$arg=$_SERVER['argv'];
$title=$arg[2] . $arg[3];
$myFile=$arg[1];