{jcomments on}
asdf
<div class="article"><a name="20131218-1"></a> <h1>Titel 1</h1> <div class="article-text">Text, Bla</div> <p class="author">Matthias Drobny</p> </div> <div class="article"><a name="20130315-1"></a> <h1>Titel 2</h1> <div class="article-text">Text, Foobar</div> <p class="author">Matthias Drobny</p> </div>
asdfasdf
define('_JEXEC', 1);
define('JPATH_BASE', "/home/test/public_html");
include_once(JPATH_BASE."/includes/defines.php");
require_once JPATH_BASE . '/includes/framework.php';
$f = "/home/test/public_html/aktuelles.html";
$xml = simplexml_load_file($f);
function setArticle($n) {
$r = "";
foreach($n->div->children() as $p) {
$r.= $p->asXML();
}
$date = explode("-", (string) $n->a['name']);
$date = (string) $n->a['name'];
$date = mktime (0, 0, 0, (int) substr($date, 4,2), (int) substr($date, 6,2), (int) substr($date, 0, 4));
$alias = strtolower($n->h1);
$alias = str_replace(" ", "-", $alias);
return $data = array(
'title' => (string) $n->h1,
'introtext' => $r,
'alias' => $alias,
'state' => 1,
'catid' => 10,
'created' => date("Y-m-d", $date),
'created_by' => 283,
'access' => 1,
);
}
function saveArticle($data) {
$table = JTable::getInstance('content', 'JTable');
$table->bind($data);
$table->check();
$table->store();
}
foreach($xml->body->children() as $n) {
$data = setArticle($n);
saveArticle($data);
}