About Features Downloads Getting Started Documentation Events Support GitHub

Love VuFind®? Consider becoming a financial supporter. Your support helps build a better VuFind®!

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_module

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
legacy:vufind_1.x_developer_manual:building_a_module [2015/12/11 18:53] – ↷ Links adapted because of a move operation demiankatzlegacy:vufind_1.x_developer_manual:building_a_module [2018/12/19 14:13] (current) demiankatz
Line 1: Line 1:
 ====== Building A Module ====== ====== Building A Module ======
  
-:!: // This page refers to VuFind 1.x; for notes on the architecture of newer versions, see [[development:architecture:customizing_vufind|the current customization page]]. // +// This outdated page has been deleted to prevent confusion; for current documentation, see [[development:architecture:customizing_vufind|this page]]. To view old content for historical interest, see the “Old Revisions” list below. //
- +
-===== Current Modules ===== +
- +
-^ Module ^ Notes       ^ +
-| Search | Provides core search functionality | +
-| Record | Provides a web page for each record | +
-| MyResearch | A portal for users to save and organize resources in a central location | +
-| Help         | Provides context sensitive help for the users | +
-| Author | Provides a web page for each author and harvests biographical information from Wikipedia | +
-| OAI         | Provides an OAI content provider service to allow for harvesting of records (currently incomplete) | +
- +
- +
- +
-===== Building Custom Modules ===== +
- +
-==== Back End Logic ==== +
- +
-Modules are very easy to build. All you need to do to integrate your code with the system is to create a directory under the web/services directory with the name of the module. Each page then has its own PHP file with a class that extends the Action class. Each page, known as an action, should mimic the Action class by implementing a method called 'launch'+
- +
-A variety of utility classes exist in the web/sys directory.  For example, the SOLR.php file allows you to make use of the underlying Solr Data Repository.  For more details on the available tools, see the [[legacy:vufind_1.x_developer_manual:system_classes|System Classes]] page. +
- +
-Your module needs to make use of [[legacy:vufind_1.x_developer_manual:global_variables|Global Variables]] to access the presentation layer and configuration file; see the linked page for more details on available globals and how to access them. +
- +
-Here is a shell for an action class: +
-<code php> +
-<?php +
-require_once 'Action.php'; +
-class MyAction extends Action +
-+
-    function launch() +
-    { +
-        global $interface; +
-        global $configArray; +
-                    +
-        $interface->setPageTitle('My Action'); +
-        $interface->setTemplate('myaction.tpl'); +
-   +
-        // Do Something Here +
-   +
-        $interface->display('layout.tpl'); +
-    } +
-+
-?> +
-</code> +
- +
- +
-==== Front End Presentation ==== +
- +
-In order to display the output of your new module, you also have to create a Smarty template file in the web/interface/themes/[theme]/[module_name]/ directory.  The template's filename is the value passed to setTemplate method of the $interface global.  For example, myaction.tpl from the example above could look like this: +
- +
-<code html> +
-<p>Hello, world!</p> +
-</code> +
- +
-See the [[:customization|User Interface Customization]] page for more details on building templates and customizing VuFind's look and feel.+
  
 ---- struct data ---- ---- struct data ----
 +properties.Page Owner : 
 ---- ----
  
legacy/vufind_1.x_developer_manual/building_a_module.txt · Last modified: 2018/12/19 14:13 by demiankatz