I love this module, particularly the customizability of it. However, would it be possible to set it up so that the same view can generate a different page and a different block? So that, for example, the block is a "list" view and the page it leads to is a "full node" or "teaser only" view?
Comments
Comment #1
merlinofchaos commentedYou can do this now but you have to use a theme_ function.
Look at the code for
theme_views_view().You can cut & paste this code as THEMENAME_views_view_VIEWNAME. If you then determine which views function to call to handle the data via checking '$type' (which will be either 'page' or 'block') instead of the switch on $view->type, you can get this result.
Even with that I can see where it'd be very convenient to have a block_type field and I'll add that to my todo list. (Alas, more schema changes. =)
Comment #2
pennywit commentedUmmmm .... Can you break that into layman's terms a bit more? Like, um ... idiot's terms? PHP and I don't mix well.
--|PW|--
Comment #3
merlinofchaos commentedPosting an example. Leaving this ticket open as I need to get this example into the the theming documentation.
Fair enough.
Ok, I'm going to make some assumptions for the following code:
1) your view name is example_view (you can easily change this in the code)
2) The view is set to 'list' type, and you've set the fields up appropriately.
3) You want the view to be a normal list when viewed as a block, but when
viewed as a page you want it to be teasers.
4) You're using the 4.7 version of the module. I'll annotate for code that you
need to remove if using 4.6
5) You're using a phptemplate theme.
Hopefully I didn't make any typos in this. Mostly it's cut & paste so I'm reasonably confident, but caveat emptor and mea culpa if it's not quite perfect.
Comment #4
merlinofchaos commentedComment #5
(not verified) commented