Sunday, Nov 1, 2009
Just been hacking away at this to get the idea across of migrating and validating data from one database into the Drupal core (Drupal 6). It relies on the user having created a content type of news from CCK.
<?php mysql_connect('localhost', 'user', 'password') or die('Cannot connect to MySql'); mysql_select_db('database') or die('Cannot connect to database'); // get the required data from the database $sql = 'select * from tableName'; $query = mysql_query($sql); // give it a timestamp $unixTimestamp = 1230800640; //starting unix timestamp $increment = 1012745; //could be replace by a rand() //beginning of the mysql insert sql queries $insertToNode = "INSERT INTO `node` (`nid`, `vid`, `type`, `language`, `title`, `uid`, `status`, `created`, `changed`, `comment`, `promote`, `moderate`, `sticky`, `tnid`, `translate`) VALUES "; $insertToNodeCommentStats = "INSERT INTO `node_comment_statistics` (`nid`, `last_comment_timestamp`, `last_comment_name`, `last_comment_uid`, `comment_count`) VALUES "; $insertToNodeRevisions = "INSERT INTO `node_revisions` (`nid`, `vid`, `uid`, `title`, `body`, `teaser`, `log`, `timestamp`, `format`) VALUES "; //get the total number of rows $totalRows = mysql_num_rows($query); $startNid = 3; // the first Node id (Nid) to be added $userUid = 1; // the id of the user (1 = admin) // create the insert queries while($result = mysql_fetch_assoc($query)){ // sanitise strings ready for insertion $headline = mysql_real_escape_string($result['headline']); $content = mysql_real_escape_string($result['content']); $snippet = mysql_real_escape_string($result['teaser']); // create looping additois to database $insertToNode = $insertToNode. ...
Monday, Oct 19, 2009
Obviously, the question as to why people are using it is one that can be prompted with a number of answers, yet I will put my few points down:
The backend/administration is understandable This can be a big problem, especially when using CMS for no IT professional, which I guess I would class myself as. Joomla has a relatively smooth and easy learning curve to being able to publish articles and create users/emails all fro its backend. ...
Monday, Oct 19, 2009
Migrating from one structure/site to another can be a complex process. I have certainly found within my new role, where I have been migrating 30+ sites to one drupal multisite installation that the process of moving sites is a convuluted one. Not only can it require the migration of databases, but also the procesig of strings to sanitise them ready for implmentation into a new database system and structure, especially when having to split strings. ...
Friday, Oct 9, 2009
I have been looking at a way of inputting content into drupal but falsifying the timestamp to show it as content created years ago. Currently I am in the process of migrating a number of static sites to drupal and as such have to manually copy and paste some of the content across. This then gives timestamps and revisions as new, despite the data being old (between 1-5 years).
I wrote this as a simple way of changing timestamps, obviously not for general use, but it does hack the nodes to pretend its old data: ...
Sunday, Sep 20, 2009
With regards to Joomla essential, much of what you need to do content writing and suchlike is alread built in. Fantastic. And for delivering content to users, either registered or public, is great.
Sunday, Sep 20, 2009
Getting started with sitemaps for SEO and discoverability.
Connect on LinkedIn. Follow me on Twitter. Grab the RSS Feed