The plugin NGG Smart Image Search provides three shortcodes for searching, displaying and commenting on images in NextGEN galleries:

[hr_SIS_nextgen_searchbox] will provide a searchbox for entering a searchstring
[hr_SIS_display_images] will provide the result list of a search
[hr_SIS_textbox] will provide different text for public or logged in users

The NGG Smart Image Search widget provides a searchbox which can be placed in the sidebar or in the header or footer section of a page. Entering searches in the widget searchbox will display the search results on an automatically generated landing page. For a detailled documentation of the widget based search see the search widget.

In contrast to the widget based search the shortcodes provide a possibility to place the searchbox and the search result list in the body of any page or post.

 

Using the searchbox shortcode

The searchbox shortcode [hr_SIS_nextgen_searchbox] provides the same functionality as the searchbox widget:

  • entering a more or less complex searchtext in a searchbox
  • defining search parameters (as shortcode parameters), which can be different for public users and for logged in users

However, whereas the widget provides a graphical interface for defining its parameters, there is no graphical interface for defining the shortcode parameters. Shortcode parameters must be specified explicitly.

The searchbox shortcode [hr_SIS_nextgen_searchbox] can be placed anywhere in the body of a page or post. It will pass the entered searchtext and the defined search parameters to the display shortcode [hr_SIS_display_images] . By default, the searchbox shortcode assumes the display shortcode to be on the same page/post as the searchbox shortcode. Otherwise the search shortcode must specify via parameter a target URL of a page/post which provides the required display shortcode.

The searchbox shortcode provides the same parametrization as the searchbox widget. You can find a complete list of possible parameters in the screenshots. You can also see the default parameter values for public users and for logged in users in the respective screenshots.

 

Shortcode examples:

[hr_SIS_nextgen_searchbox]

This provides a searchbox with default parameter settings. By default, the search will be carried out across all NextGEN galleries.

[hr_SIS_nextgen_searchbox include_galleries=selected search_album=’3,4′ exclude_galleries=selected excluded_galleries=’10,12,13′ limit=’40’]

This provides a searchbox with some adjusted search parameters. The search will be carried out across all NextGEN galleries included in the two NextGEN albums with album ID 3 and 4, but excluding galleries with ID 10,12 or 13. The size of the result list is limited by 40 images.

[hr_SIS_nextgen_searchbox include_galleries=selected pu_search_album=’3,4′ lo_search_album=’1,2′ limit=’40’]

This searchbox has a different search scope for public users and for logged in users. For public users the search will be carried out in NextGEN album 3 and 4, whereas for logged in users the search will be carried out across NextGEN album 1 and 2. The limit parameter applies to both user types.

As one can see on this example, search parameters without prefix ‚pu_‘ or ‚lo_‘ apply to all user types whereas parameters with prefix  ‚pu_‘ or ‚lo_‘ only apply to public users or to logged in users respectively.

General remarks:

Providing NextGEN album Ids as possible parameters provides a smart way to add or change NextGEN galleries without adjusting search parameters. For example, if public user shall only search in public galleries you can set up a (nested) NextGEN album for all public galleries. When including a new gallery in this ‚public‘ abum, searches will automatically consider this new gallery for public searches if these searches refer to this public album.

 

Using the display shortcode

The display shortcode [hr_SIS_display_images] provides the following functionality:

  • it will generate an internal list of NextGEN picture ids (pid) in response to a search request consisting of searchtext and search parameters. This search request can be initiated 
    • dynamically by a searchbox widget
    • dynamically by a searchbox shortcode (on the same page)
    • by a static display shortcode parameter (without searchbox)
  • it will display a search result list as 
    • a single image list
    • a selfcoded thumbnail gallery
    • an original NextGEN gallery

The various possibilities for displaying the search result list are explained here in more detail.

 

Display shortcode parameter static_search

This parameter provides a smart mean to extend native NextGEN gallery display functionality. By providing any acceptable searchstring as parameter input one can display almost any collection of images as a NextGEN gallery.

If the parameter static_search is set for the display shortcode,  the display shortcode will also accept any searchbox shortcode parameter to specify the search. In addition, if the static_search parameter is set, the display shortcode will ignore any search parameters passed by a searchbox widget or searchbox shortcode.

 

Display shortcode parameter verbose

This parameter provides a leading text for a search result list (verbose=1) by summarizing the number of found images. This is the default setting.

Setting verbose=0 will suppress this leading text. 

 

Shortcode examples:

[hr_SIS_display_images] 

Without parameters this display shortcode will show any search result list by default as a single image list (see explanation  here ). Without static_search parameter the shortcode needs the search input passed by a searchbox widget or searchbox shortcode.

[hr_SIS_display_images static_search=“r:15″ display=”ngg_pro_mosaic” verbose=’0′ include_galleries=selected search_album=2 ]

This display shortcode will list the 15 most recent images of galleries in NextGEN album with id 2. It will display the images as a NextGEN Pro Mosaic gallery (the plugin NextGEN Pro must be installed as well for this display type).

 

Using the textbox shortcode

The textbox shortcode [hr_SIS_textbox] provides the possibility to show different texts for public users and for logged in users. It only accepts one parameter usertype:

  • usertype=’public‘  specifies text for public users
  • usertype=’logged_in‘ specifies text for loggin users

The desired user specific text is enclosed by an opening shortcode [hr_SIS_textbox] and a closing short code [\hr_SIS_textbox]

Shortcode examples:

[hr_SIS_textbox usertype=’public’]This text will only be displayed for public users.[\hr_SIS_textbox][hr_SIS_textbox usertype=’logged_in’]This text will only be displayed for logged in users.[\hr_SIS_textbox[