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.
configuration:static_pages

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
configuration:static_pages [2021/11/09 11:33] demiankatzconfiguration:static_pages [2023/07/27 12:30] (current) demiankatz
Line 1: Line 1:
 ====== Static Pages ====== ====== Static Pages ======
  
-:!: This feature was introduced in VuFind 4.0+:!: This feature was introduced in VuFind® 4.0
  
-It is sometimes useful to host mostly-static HTML content pages within the framework of VuFind itself. The system provides a simple mechanism for serving arbitrary templates, including internationalization support.+It is sometimes useful to host mostly-static HTML content pages within the framework of VuFind® itself. The system provides a simple mechanism for serving arbitrary templates, including internationalization support.
  
 ===== Simple Example ===== ===== Simple Example =====
Line 9: Line 9:
 For static content, simply create a new template inside the templates/content folder of your theme. You can then link to this content using the content-page route with the template name passed to the route as the 'page' parameter. For static content, simply create a new template inside the templates/content folder of your theme. You can then link to this content using the content-page route with the template name passed to the route as the 'page' parameter.
  
-VuFind ships with an [[https://github.com/vufind-org/vufind/blob/dev/themes/bootstrap3/templates/content/faq.phtml|example FAQ template]] showing how to set up this simple scenario. The link to this page is:+VuFind® ships with an [[https://github.com/vufind-org/vufind/blob/dev/themes/bootstrap3/templates/content/faq.phtml|example FAQ template]] showing how to set up this simple scenario. The link to this page is:
  
 <code> <code>
Line 25: Line 25:
 ===== Multi-language Example ===== ===== Multi-language Example =====
  
-The content system also supports i18n. If you create different versions of a template with filenames suffixed with a language code (e.g. faq_en.phtml, faq_de.phtml, etc.) VuFind will attempt to load the version matching the user's selected language. If no match is found, it will next attempt to load the template matching the configured default language. If that is not found, it will finally default to the non-suffixed version of the filename.+The content system also supports i18n. If you create different versions of a template with filenames suffixed with a language code (e.g. faq_en.phtml, faq_de.phtml, etc.) VuFind® will attempt to load the version matching the user's selected language. If no match is found, it will next attempt to load the template matching the configured default language. If that is not found, it will finally default to the non-suffixed version of the filename.
  
 For an example, see the asklibrary.phtml and asklibrary_en.phtml templates in the [[https://github.com/vufind-org/vufind/tree/dev/themes/bootstrap3/templates/content|content template folder]]. For an example, see the asklibrary.phtml and asklibrary_en.phtml templates in the [[https://github.com/vufind-org/vufind/tree/dev/themes/bootstrap3/templates/content|content template folder]].
Line 31: Line 31:
 ===== Markdown Support ===== ===== Markdown Support =====
  
-:!: This feature was introduced in VuFind 7.0.+:!: This feature was introduced in VuFind® 7.0.
  
 If you prefer to build your content pages using [[https://en.wikipedia.org/wiki/Markdown|Markdown]] instead of PHP templates, you can simply name the files you create under the templates/content directory of your theme with .md extensions instead of .phtml extensions, and they will be displayed appropriately. If you create both .phtml and .md files with the same base name, the .phtml file will take precedence over the .md file. If you prefer to build your content pages using [[https://en.wikipedia.org/wiki/Markdown|Markdown]] instead of PHP templates, you can simply name the files you create under the templates/content directory of your theme with .md extensions instead of .phtml extensions, and they will be displayed appropriately. If you create both .phtml and .md files with the same base name, the .phtml file will take precedence over the .md file.
Line 37: Line 37:
 ===== Embedding Static Content ===== ===== Embedding Static Content =====
  
-There may be situations where you want to embed static content inside another custom template, instead of rendering it as a stand-alone page (for example, an "About Us" section on your home page, which you might choose to implement as a very simple [[development:plugins:contentblocks|content block]] with a custom template). Starting with VuFind 8.0, you can use the Content view helper to embed static content, with full support for the other features described here (i18n and Markdown rendering). If you follow the normal conventions for creating content, you can simply use:+There may be situations where you want to embed static content inside another custom template, instead of rendering it as a stand-alone page (for example, an "About Us" section on your home page, which you might choose to implement as a very simple [[development:plugins:contentblocks|content block]] with a custom template). Starting with VuFind® 8.0, you can use the Content view helper to embed static content, with full support for the other features described here (i18n and Markdown rendering). If you follow the normal conventions for creating content, you can simply use:
  
 <code php> <code php>
Line 43: Line 43:
 </code> </code>
  
-This will display the content of "contentPageName" inline, applying the usual internationalization conventions and searching all supported template formats. The renderTranslated method also accepts several additional parameters which can be used to customize the behavior, in case you want to search a different template directory or apply a different naming convention. You can refer to [[https://github.com/vufind-org/vufind/blob/dev/module/VuFind/src/VuFind/View/Helper/Root/Content.php|the Content helper's source code]] for details. An example of advanced features in action can be found in the [[https://github.com/vufind-org/vufind/blob/dev/module/VuFind/src/VuFind/View/Helper/Root/HelpText.php|HelpText view helper]], which now uses the Content helper's advanced features to display VuFind's help pages.+This will display the content of "contentPageName" inline, applying the usual internationalization conventions and searching all supported template formats. The renderTranslated method also accepts several additional parameters which can be used to customize the behavior, in case you want to search a different template directory or apply a different naming convention. You can refer to [[https://github.com/vufind-org/vufind/blob/dev/module/VuFind/src/VuFind/View/Helper/Root/Content.php|the Content helper's source code]] for details. An example of advanced features in action can be found in the [[https://github.com/vufind-org/vufind/blob/dev/module/VuFind/src/VuFind/View/Helper/Root/HelpText.php|HelpText view helper]], which now uses the Content helper's advanced features to display VuFind®'s help pages.
  
 ===== Video ===== ===== Video =====
Line 49: Line 49:
 This topic is discussed in the [[videos:managing_static_content|Managing Static Content]] tutorial video. This topic is discussed in the [[videos:managing_static_content|Managing Static Content]] tutorial video.
 ---- struct data ---- ---- struct data ----
 +properties.Page Owner : 
 ---- ----
  
configuration/static_pages.txt · Last modified: 2023/07/27 12:30 by demiankatz