Importing a drupal view programmatically
If you need to import a drupal view programmatically, it is fairly simple:
include_once(drupal_get_path('module', 'views') .'/views.module');
include_once(drupal_get_path('module', 'views') .'/includes/view.inc');
include_once(drupal_get_path('module', 'views') .'/includes/cache.inc') ;
include_once(drupal_get_path('module', 'views') .'/includes/convert.inc');
/* ... insert import code here */
views1_import($view);
$view->save();
There is another way to do it, by setting up a custom module. The good thing about going the custom-module route, is you don't need to hit the DB for the view information.

Comments
Post new comment