你正在做出正确的决定。移至 CMS。我已成功将数据(类别、文章和图像)迁移到 Joomla 安装中,步骤如下:
- 从您的 CMS 相关数据中选择
如果图片与 CMS 中的文章分开存储,请在前面至少添加一个
到文本并附加其余部分;
- J2.5+ 支持文章图片和缩略图,但模板仍然没有实现
- 除非您需要在文章级别进行细粒度访问,否则将所有文章指向单个资产 ID
- 创建示例文章并使用额外字段填写空白
- 如果可能,使用适当的 IntroText 和 FullText 分离;确保进入每个的 html 是独立的并验证
- 验证您的数据是 UTF-8(否则转换它)然后运行 SQL 导入
- 从文章管理器中选择重建图标来重建资产和 ltr-rtl 字段
要执行 SQL 导入,您还需要清除 content_frontpage 表。
这是一个从另一个 cms 接收一行并将其放入 Joomla 的函数;一些评论是用意大利语写的,但你应该知道如何去做。mdc2j 是我编写的专用函数,用于根据需要正确转义数据并更改格式/类别 ID 等。
function importaArticolo($row) {
global $link;
echo "<h3>Importa Articolo ".$row->Id . " (". $row->titolo . ")</h3>";
/*
" ('$row->id', '0', 'test', 'test_alias', '', 'tutto il testo riga per riga', ".
" '', '0', '0', '0', '111', '2001-01-25 16:30:15', '4', 'la firma', '2001-01-25 16:30:15', ".
" '0', '0', '0000-00-00 00:00:00', '2001-01-25 16:30:30', '0000-00-00 00:00:00', 'list of images?', 'list of urls?', ".
" '".'{"show_title":"","link_titles":"","show_intro":"","show_category":"","link_category":"","show_parent_category":"","link_parent_category":"","show_author":"","link_author":"","show_create_date":"","show_modify_date":"","show_publish_date":"","show_item_navigation":"","show_icons":"","show_print_icon":"","show_email_icon":"","show_vote":"","show_hits":"","show_noauth":"","alternative_readmore":"","article_layout":""}'."', ".
" '1', '0', '0', 'kewords', 'key-description', ".
" '0', '0', ".
" '".'{"robots":"","author":"","rights":"","xreference":""}'."', '0', '*', '');";
*/
try {
$idcategory = mdc2jCategory($row->idCanale);
if ($row->isDossier * 1 == 1) {
if (1*$idcategory==10) {
$idcategory= 28;
}
}
$default_user=42;
$SQL=sprintf(
"INSERT INTO `".$GLOBALS['db_database_new']."`.`eco_content` (`id`, `asset_id`, `title`, `alias`, `title_alias`, `introtext`, ".
" `fulltext`, `state`, `sectionid`, `mask`, `catid`, `created`, `created_by`, `created_by_alias`, `modified`, ".
" `modified_by`, `checked_out`, `checked_out_time`, `publish_up`, `publish_down`, `images`, `urls`, `attribs`, ".
" `version`, `parentid`, `ordering`, `metakey`, `metadesc`, `access`, `hits`, `metadata`, `featured`, `language`, ".
" `xreference`) ".
" VALUES ".
" ('%d', '0', '%s', '%s', '', '%s', ".
" '%s', '%d', '0', '0', '%d', '%s', '%d', '%s', '%s', ".
" '0', '0', '0000-00-00 00:00:00', '%s', '0000-00-00 00:00:00', '', '', ".
" '".'{"show_title":"","link_titles":"","show_intro":"","show_category":"","link_category":"","show_parent_category":"","link_parent_category":"","show_author":"","link_author":"","show_create_date":"","show_modify_date":"","show_publish_date":"","show_item_navigation":"","show_icons":"","show_print_icon":"","show_email_icon":"","show_vote":"","show_hits":"","show_noauth":"","alternative_readmore":"","article_layout":""}'."', ".
" '1', '0', '0', '%s', '%s', ".
" '%d', '%d', ".
" '".'{"robots":"","author":"","rights":"","xreference":""}'."', '%d', '*', '');",
$row->Id,
mysql_real_escape_string($row->titolo),
makeAlias($row->titolo), // alias
mdc2jSommario($row), // this creates the introtext
mdc2jText($row), // this returns the text
$row->idStato=="2"?0:1, // idStato="suspended"
$idcategory, // correct category id
mdc2jDate($row->dataCreazione),
$default_user,
mdc2jFirma($row->firma),
mdc2jDate($row->dataCreazione), //2001-01-25 16:30:15
mdc2jDate($row->dataPubblica), //2001-01-25 16:30:30
mdc2jMetaKeywords($row), // adds "dossier" if appropriate
mdc2jMetaDesc($row), // if not assigned, create it automatically
$row->idStato=="2"?3:1,
$row->viewCounter,
0 //featured: (($row->Id % 13) == 0 ? 1 : 0 )
);
$res = mysql_query($SQL);
if ($res) {
$lastid = mysql_insert_id();
//echo "Article $lastid ($row->Id) Inserted into DB<br>";
// this will import images in a separate tool, an ignite gallery, so it's not really meaningful for you:
importaImmagini($row->Id, $row->canale, $row->cid);
return 1;
}
else {
echo "<span class='err'>WARNING: article not inserted in db</span>"."<br>".mysql_errno($link) . ": " . mysql_error($link);
echo "<textarea cols='80' rows='3'>".$SQL."</textarea><br>";
}
return 0;
}
catch (Exception $e)
{
echo "<span class='err'>Exception! ".$e->getMessage()."</span><br>";
return 0;
}
}