Page 1 of 1
Adding pages programatically
Posted: Tue Aug 07, 2007 2:29 pm
by junkmailtrapenator
I'm looking at migrating from an old custom cms to CMS Made Simple. Does any one have any experience with pre-populating CMSMS with old data and can point me in the right direction to get started?
Specifically is there a function or something I can call to easily add a page and/or news item? If not where are all the spots I'd have to touch in the DB?
Thanks,
Re: Adding pages programatically
Posted: Tue Aug 07, 2007 9:25 pm
by Pierre M.
Hello,
I am not aware of any mass import tool. But there are
people trying with success and more to come.
If you know PHP and SQL, I think the CMSms code which creates/updates a page is a good start to learn how to add pages programatically.
Mass content import seems a nice feature for several people, doesn't it ?
Pierre M.
Re: Adding pages programatically
Posted: Wed Aug 08, 2007 5:14 pm
by junkmailtrapenator
Thanks,
I'm not looking for a "mass import tool" exactly, just something that I could call from an external script. Kinda like addPage($content,$template,$etc);
Not really a requirement for what I'm doing, but it'd be interesting if something like that were implemented as a web service.
Re: Adding pages programatically
Posted: Fri Aug 17, 2007 10:50 am
by jovo
It can be done.
Only 4 tables are involved
I have imported the content of an old site (with CMSMS 0.13) into a new CMSMS 1.0-site in the following way
- exporting with phpmyadmin the tables cms_content and cms_content_props
- no export of the structure
- complete INSERT so the fieldnames are included (the layout of the tables are somewhat different)
- dropping the content of these tables in the new database (otherwise duplicate id's appear)
- importing the content via the commandline tool mysql into the new database
- manual adjusting cms_content_seq and cms_content_prop_seq (via phpmyadmin). These rows must contain the largest used contentid. (For one reason or another CMSMS does not use autoincrement fields)
- via the admin panel setting the template of the pages to a correct value
The wanted program should get the following data
- the content-id of the parent
- evt. the template-id although it can be copied from the parent
- the title
- the content of the page
The other data can be retrieved from the database (sequence number, hierarchy) or generated from the supplied data (content_alias,hierarchy_path)
And you must retrieve and modify cms_content_seq and cms_content_props_seq
For a programmer with Perl and Perl::DBI experience: 2-3 hours work