1

Is it possible in a TPL to create a link to a View page? Rather than hard code the link I would like it to update if the URL of the view page changes.

2 Answers 2

0

If the Page display name of the view is page, then it prints the path

$view = views_get_view($view_name, TRUE);      
print $view->display['page']->display_options['path'];
3
  • Is $view_name the machine name of the View? Do I keep the $ at the beginning?
    – Evanss
    Commented Apr 23, 2015 at 11:22
  • No it is just the name, for example if the it is library then use views_get_view("library", TRUE);
    – M a m a D
    Commented Apr 23, 2015 at 12:10
  • Ah I missed off the "".
    – Evanss
    Commented Apr 23, 2015 at 12:59
0

Use views_get_view to get $view object.

Using view object you can find view path. It expects view name, which would obviously remain intact in your case.

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.