[development] VIEWS MODULE: save a view as php code
James Gilliland
neclimdul at gmail.com
Wed Jun 7 22:55:36 UTC 2006
Ok, I'm not entirely sure of your needs so I'll out line a couple ways
that to do what you have said.
First the views_ui.module has the ability to export and import views.
You should be able to use the exported php code and views_build_view
function to display that view as you have stated. I'm not sure how
"right" that is but its and option and it would allow your module to
be distributed with the view built in and not to rely on a view stored
by views.
The second option is to use a view stored by views (this would mean on
that you see in your views_ui edit page). You should be able to call
'views_get_view($viewname)' and the return is the view object. Then
you follow the same steps as before to modify the view and then call
views_build_view to display it.
If possible it would seem a good practice to modify the view as little
as possible and use the views concept of arguements which you can
pass to views_build_view.
Hope that answers all you questions. I can pass on some example code
but for the most part that exhausts my knowledge of views so you'll
have to get someone closer to the project to learn anything past that.
James
On 6/7/06, Srimal Jayawardena <srimalj at gmail.com> wrote:
> Hi
>
> does anyone know how to save a particular view (made using the views module)
> as php code..
>
> The idea is to tweak that php file to further customise the view page.
>
> The page url given as view/myview etc is an internal one right? Anyway i can
> get the php code of that location? o r is ther e a way to save the view page
> as a normal php file?
>
>
> tnx in advance
>
>
> Srimail.
>
More information about the development
mailing list