1

I have a PHP script in which I want to set the path to a view. For example on site1 I want the news to be at /news/index.html and on site2 I want the news to be at /blog/news/page/1. The sites are sharing the modules folder so I cannot do this from the modules files. So I have a script in which I'm doing my initial setup for each website. Everything works perfect but the view path is not saved.

1. $view = views_get_view('news');
2. $view->display['page']->handler->options['options']['path'] = $my_path;
3. $view->save();

I also tried to use $view->override_path instead of line 2 but it's still not working.

1 Answer 1

2

I managed to find the right way. The following code works great for me.

$view = views_get_view($view_name, TRUE);
$view->display['page']->display_options['path'] = $new_path;
views_save_view($view);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.