About Features Downloads Getting Started Documentation Events Support GitHub

Site Tools


Warning: This page has not been updated in over over a year and may be outdated or deprecated.
legacy:vufind_1.x_developer_manual:building_a_smarty_plugin

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
legacy:vufind_1.x_developer_manual:building_a_smarty_plugin [2007/11/20 20:42]
asnagy
legacy:vufind_1.x_developer_manual:building_a_smarty_plugin [2018/12/19 14:12] (current)
demiankatz
Line 1: Line 1:
-====== Building Plugin ====== +====== Building a Smarty Plugin ======
- +
-VuFind uses the [[http://smarty.php.net/|Smarty Template Engine]] to control the HTML templates.  Smarty has the ability to create plugins to be intergrated in with the templates.  If you would like to create a Plugin to enhance VuFind - for example a SQL Query to your ILS Database for additional data on the Record View Page or a new query to the SOLR data store - you could simply create a PHP file that lives within the /web/interface/plugins directory.  Please follow the [[http://smarty.php.net/manual/en/plugins.php|Smarty Documentation]] on how to create a plugin. +
- +
-Here is an arbitrary example of a plugin that interacts with the SOLR data store: +
- +
-<code php> +
-filename: /web/interface/plugins/function.showqauthors.php +
-<?php +
-/* +
- * Smarty plugin +
- * ------------------------------------------------------------- +
- * Type:     function +
- * Name:     Show Q Authors +
- * Purpose:  Runs a SOLR query to find all Q authors +
- * ------------------------------------------------------------- +
- */ +
-function smarty_modifier_showqauthors() +
-+
-    global $solr; +
-     +
-    $solr->raw = false; // Do not return Raw XML data (use array) +
- +
-    $result = $solr->query('authorStr:Q*'); // Run Search +
- +
-    // Create Output +
-    $html = "<ul>\n"; +
-    foreach ($result as $author) { +
-        $html .= "<li>$author</li>\n"; +
-    } +
-    $html .= "</ul>\n"; +
- +
-    // Return Output +
-    return $html; +
-+
-?> +
-</code>+
  
 +// This outdated page has been deleted to prevent confusion. To view old content for historical interest, see the "Old Revisions" list below. //
 ---- struct data ---- ---- struct data ----
 +properties.Page Owner : 
 ---- ----
  
legacy/vufind_1.x_developer_manual/building_a_smarty_plugin.1195591375.txt.gz · Last modified: 2014/06/13 13:12 (external edit)