Hello,

I have created a view called 'calendar'. I want to change the items_per_page value of the 'upcoming' block programmatically. So I execute the following code in a test module:

$view = views_get_view('calendar', TRUE);
$view->set_display('upcoming');
$view->init_pager();

$view->set_items_per_page('50');

$view->save();

The update is made but the change is not saved. It seems that $view->save() doesn't really save the view.

What could be the problem in this case? Is something missing/wrong in the code? What would be the proper way to achieve the desired functionality?

Thank you,

- nikos

Comments

I haven't created a view

I haven't created a view programmatically. You can create views by "hook_views_default_views".
To update views, try this link. It may help you.

nobody click here