| 1 |
OVERVIEW
|
| 2 |
--------
|
| 3 |
The Views module allows administrators to create dynamic lists of content
|
| 4 |
for display in pages or blocks. It is possible to insert those lists into
|
| 5 |
existing node bodies and blocks, but such inclusion requires that PHP
|
| 6 |
filtering be turned on. The Insert View module allows any user to insert
|
| 7 |
view listings using tag syntax, without the need for PHP execution
|
| 8 |
permissions. The Insert View tag syntax for embedding a view is relatively
|
| 9 |
simple.
|
| 10 |
|
| 11 |
[view:my_view]
|
| 12 |
is replaced by the content listing corresponding to the named view. In this
|
| 13 |
case it is my_view.
|
| 14 |
|
| 15 |
[view:my_view=my_display]
|
| 16 |
invokes the my_view view using the my_display view display ID. If the display
|
| 17 |
slot is left empty, the view\'s "default" display is used.
|
| 18 |
|
| 19 |
See "HOW TO FIND A DISPLAY ID" below for help with display IDs.
|
| 20 |
|
| 21 |
Note: the display slot was previously used (in the Drupal 5 version) to provide
|
| 22 |
numeric limiters to control the number of nodes to display in a view. This sort
|
| 23 |
of local override has been deprecated in favor of taking advantage of Views
|
| 24 |
version 2's custom display functionality. See "UPGRADING FROM A PREVIOUS
|
| 25 |
VERSION" below for more information.
|
| 26 |
|
| 27 |
[view:my_view=my_display=1,2,3]
|
| 28 |
uses the my_display view display, and passes a comma delimited list of arguments
|
| 29 |
(in this case 1, 2, and 3) to the view.
|
| 30 |
|
| 31 |
Here's an example you could use with the default view named "tracker" which
|
| 32 |
uses the page display and takes a user ID as an argument:
|
| 33 |
|
| 34 |
[view:tracker=page=1]
|
| 35 |
|
| 36 |
In short this tag says, "Insert the view named tracker, use the "page" display,
|
| 37 |
and supply the argument 1."
|
| 38 |
|
| 39 |
Sometimes you want to pass an argument without specifying a display ID. You can
|
| 40 |
do that by leaving the display ID slot empty, like so:
|
| 41 |
|
| 42 |
[view:my_view==1]
|
| 43 |
|
| 44 |
In previous versions you could use the [view_pager:my_view] tag. It has been
|
| 45 |
deprecated in the Drupal 6 branch in favor of using views displays. See
|
| 46 |
"UPGRADING FROM A PREVIOUS VERSION" below for more information.
|
| 47 |
|
| 48 |
HOW TO FIND A DISPLAY ID
|
| 49 |
------------------------
|
| 50 |
On the edit page for the view in question, you'll find a list of displays at the
|
| 51 |
left side of the control area. "Defaults" will be at the top of that list. Hover
|
| 52 |
your mouse pointer over the name of the display you want to use. A URL will
|
| 53 |
appear in the status bar of your browser. This is usually at the bottom of the
|
| 54 |
window, in the chrome. Everything after #views-tab- is the display ID. For
|
| 55 |
example in http://localhost/admin/build/views/edit/tracker?destination=node%2F51#views-tab-page
|
| 56 |
the display ID would be "page".
|
| 57 |
|
| 58 |
INSTALLATION
|
| 59 |
------------
|
| 60 |
Extract and save the Insert View folder in your site's modules folder and enable
|
| 61 |
it at admin/build/modules. Obviously, it requires the Views module to do its
|
| 62 |
magic.
|
| 63 |
|
| 64 |
Once Insert View is installed, visit the the input formats page at
|
| 65 |
/admin/settings/filters and click the "configure" link for the input format(s)
|
| 66 |
for which you wish to enable the Insert View Filter. Then simply check the
|
| 67 |
checkbox for the filter.
|
| 68 |
|
| 69 |
IMPORTANT PERFORMANCE NOTE: To dispaly views correctly, Insert View turns off
|
| 70 |
caching for the input formats for which it is enabled. That means every node
|
| 71 |
using this input format will not be cacheable. This can impact site performance.
|
| 72 |
In these cases, it is recommended to create a special input format for use when
|
| 73 |
inserting views.
|
| 74 |
|
| 75 |
UPGRADING FROM A PREVIOUS VERSION?
|
| 76 |
----------------------------------
|
| 77 |
IF YOU UPGRADED FROM THE DRUPAL 5 VERSION OF INSERT VIEW:
|
| 78 |
|
| 79 |
THE LIMITERS SLOT IS NOW USED FOR DISPLAYS
|
| 80 |
Previously in Insert View the display slot was used to provide a numeric value
|
| 81 |
representing the number of nodes to display when showing the view. This has been
|
| 82 |
deprecated due to changes in Views version 2. With the ability to create custom
|
| 83 |
displays, we can use Views' functionality to make a unique view display to use
|
| 84 |
with Insert View. ALL EXISTING VIEWS USING THE NUMBER LIMITERS SHOULD CONTINUE
|
| 85 |
TO WORK, BUT WILL BE BASED OFF THEIR VIEWS' DEFAULT DISPLAY.
|
| 86 |
|
| 87 |
VIEW_PAGER SYNTAX HAS BEEN DEPRECATED
|
| 88 |
Previously in the Drupal 5 version, Insert View tags such as the one below could
|
| 89 |
be used to control the use of pagers in views. As of the Drupal 6 version,
|
| 90 |
however, you should simply use the settings in your views display to set the
|
| 91 |
pager. If your inserted view will require pager settings different than the base
|
| 92 |
view settings, simply create a new display via the Views interface and override
|
| 93 |
those settings.
|
| 94 |
|
| 95 |
Example of the deprecated tag: [view_pager:<name of view>=<number>]
|
| 96 |
|
| 97 |
CHANGES WITHIN THE DRUPAL 5 BRANCH OF INSERT VIEW:
|
| 98 |
|
| 99 |
In previous versions of Insert View (including the 2008-Jan-11 development snapshot
|
| 100 |
and earlier) it was was not required to enable the Insert View filter for input formats
|
| 101 |
(by visiting the /admin/settings/filters pages) because Insert View was a pseudo filter
|
| 102 |
and used hook_nodeapi() rather than the filter system.
|
| 103 |
|
| 104 |
Insert View now runs as a classic Drupal filter module, and that means it now works
|
| 105 |
in blocks. If you upgrade your site and find Insert View tags aren't working, please
|
| 106 |
visit /admin/settings/filters and enable the Insert View Filter for each input format
|
| 107 |
necessary.
|