Getting a view's ID from its name
I'm trying to get the id of a view by supplying its name. Right now I have to insert t开发者_开发知识库he view into a node, then inspect it with dsm to see its ID, which I then hardcode where I need it. That's not a good workflow. If at least I could get the view's ID without inserting it somewhere first and inspecting it with dsm, that would be better. I tried finding the view's ID from the views list, but couldn't see it anywhere, all I see is the view's name.
Is there a way to get the ID from the views interface or programmatically by loading the view based on its name, then checking its ID. But my concern with the latter option is that I don't want to burden the page with loading and rendering the view just to read the ID. I don't know how heavy that would be.
Views auto generate some class names, but you are not forced to use them and if you customize views template you can exclude them.
However, on the top div wrapper, you will get class names that you can use:
- view-[name]
- view-id-[name]
The name is what views used internally, whatever you gave it when you created it, only _
will be replaced with -
If it's the vid
you are after, you can find it in the view_views
table. You can use the above mentioned name to get it.
精彩评论