Term Images for "Importing a drupal view programmatically"

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.

Your rating: None

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
The fucking spammers are ruining the internets. Sadly I need to make sure you are human.
3 + 8 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.