(I don't know the best way to word this but here goes!) I have a site that is in PHP and it grabs certain data from tables depending on an identifier input like .php?id=500 and looks up from each table grabbing each respective fields and putting them into tables or lists.
What is the best easy CMS that I would use? How would I approach this? Is there a simple plugin for something like Joomla or Wordpress or the such I can point to specific tables, tell it the identifier column, and tell it to list every row that matches? Including other tables?
IE. It pulls something from address table and lists all their address, pulls something from information and lists their gender age, and etc.
So this way, it creates dynamic pages that I can manage a lot easier and have searches and indexes. Trying to code all that and it's getting way ahead of me. I figured there's a CMS that does all this for me.
I hope you guys understand my question, I tried searching many wordings of this.
You're making the right decision. Move to a CMS. I have successfully migrated data (categories, articles and images) into a Joomla installation, the steps are:
if pictures are stored separately from articles in your CMS, prepend at least one
to the text and append the rest;
To perform the SQL Import you need to also clear the content_frontpage table.
Here is a function that receives a row from another cms and puts it into Joomla; a few comments are in Italian but you should get a feel of how to do it. mdc2j are dedicated functions I wrote to proper escape the data and change formats/category ids etc. as needed.
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;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With