Changes

Jump to navigation Jump to search
1,004 bytes added ,  10:35, 25 November 2020
m
Add References section
Templates are a system for streamlining the data entry and display formatting of article content.
 
Unfortunately, despite (old) efforts like '[https://meta.wikimedia.org/wiki/Requests_for_comment/Global_bits_and_pieces Global Bits and Pieces]' or [https://meta.wikimedia.org/wiki/Global-Wiki Global Wiki], [https://www.mediawiki.org/wiki/Global_templates Global Templates], '''MediaWiki software does not come with bundled templates'''. There is no 'package' or 'Starter Kit' of useful templates. Each wiki is left to create their own. Although you ''could'' export and import templates from say mediawiki.org, you would end up with a huge amount of Lua modules and template code that would be overkill for any regular use case. Global Templates was mentioned in the 2020 Community Wishlist under 'miscellaneous' -> 'translate templates' <ref>https://meta.wikimedia.org/wiki/Community_Wishlist_Survey_2021/Miscellaneous/Templates_translation</ref> but it's not an exact match, and likely won't be adopted anyway. Still, there are at least a couple 'Phabricator' issues related to Templates: https://phabricator.wikimedia.org/T121470 https://phabricator.wikimedia.org/T243150
=== Types and Examples ===
==== Static Templates ====
Templates can also be used to include static content on a page (kind of like a keyword macro). This is useful when you want to mark a bunch of pages with some common message content, e.g. 'obsolete', '[[:Template:stub|stub]]', 'needs attention' etc.; or perhaps you have a collection of articles that you want to apply a common resource box or navigation to.
 
 
=== Using Templates ===
# (optional) create a new page
=== Available Templates ===
See all templates in the [[Special:Prefixindex|prefix index]] (choose the 'Template' namespace in the select box, then press 'Go')
 
=== Debugging Templates ===
You can add <code>action=raw&templates=expand</code> to the end of a page URL to see the raw wikitext as
=== See also ===
The "[[transclusion]]" idea is similar (and shares the same basic syntax) allowing you to include other article content by inclusion.
== OpenOffice Office Templates ==The [[Open Office]] productivity suite includes a template system so that you can create documents that have a common layout.* Templates are good to create a uniform look to See [[presentationLibreOffice]]s made with OpenOffice Impress.* [http://documentation.openoffice.org/Samples_Templates/User/template/index.html the documentation project] offers many templates you can add to your default OpenOffice installation. A Google search will reveal many more if you are looking for something in particular.To use OpenOffice templates in your local system, save the tempate file to your local user template directory. E.g. for Linux users, it would be "/home/<nowiki>[user]</nowiki> /.openoffice.org2/user/template/"
== Programming with Template Systems ==
=== Smarty ===
For PHP programmers, one of the oldest and well-known template systems (aside from building your own using includes) is the [http://smarty.php.net Smarty] system. For a quick overview, see [[wp:Smarty]] There is also a crash course on the Smarty website in addition to the [http://smarty.php.net/manual/en/ documentation]
==== Smarty in CiviCRM ====
As of Feb. 2016, Civi uses Smarty v2
 
Something like this little one-liner can help to generate your Smarty captures if you have a long list of custom variables
<source lang="php">
php -r 'include ("/var/www/equality-tech.com/www/drupal/sites/all/modules/custom/eqt/eqt.module"); $stack="stats"; $vars = getHaystack($stack); foreach ($vars as $k=>$v) {print "{capture assign=$k}{{$stack}.$k}{/capture}\n";};';
</source>
 
 
 
=== Drupal ===
Offers a choice of template systems
=== Django ===
Uses the Django Template system
 
{{References}}
 
[[Category:Help]]
[[Category:Wiki]]

Navigation menu