You are here

function contemplate_help in Content Templates (Contemplate) 5

Same name and namespace in other branches
  1. 6 contemplate.module \contemplate_help()
  2. 7 contemplate.module \contemplate_help()

Implementation of hook_help().

File

./contemplate.module, line 16
Create templates to customize teaser and body content.

Code

function contemplate_help($section) {
  switch ($section) {
    case 'admin/content/templates/' . arg(3):
    case 'admin/content/types/' . arg(3) . '/template':
      return t('<p>Enable the textareas by enabling the checkbox above each. Expand the variables section to display. Then click on content attributes to insert the appropriate PHP <code>print</code> statements at your cursor position in the textarea.</p>
<p>It is also possible to create disk-based templates. ' . (module_exists('help') ? 'Find more information about that <a href="!link">here</a>' : 'For help on this enable the \'help\' module, and you will find a link here.') . '
<p>Please note that by creating a template for this content type, you are taking full control of its output and you will need to manually add all of the fields that you would like to see in the output. Click <em>reset</em> to remove template control for this content type.</p>', module_exists('help') ? array(
        '!link' => url('admin/help/contemplate', NULL, 'disk-based'),
      ) : '') . (module_exists('help') ? theme('more_help_link', url('admin/help/contemplate')) : '');
    case 'admin/help#contemplate':
      return t('<p>The Content Templates (a.k.a. contemplate) module allows modification of the teaser and body fields using administrator defined templates. These templates use PHP code and all of the node object variables are available for use in the template. An example node object is displayed and it is as simple as clicking on its properties to add them to the current template.</p>

<p>This module was written to solve a need with the Content Construction Kit (CCK), where it had a tendency toward outputting content in a not-very-pretty way. And as such, it dovetails nicely with CCK, adding a "template" tab to CCK content-type editing pages and pre-populating the templates with CCK\'s default layout. This makes it easy to rearrange fields, output different fields for teaser and body, remove the field title headers, output fields wrapped for use with tabs.module (part of JSTools), or anything you need.</p>

<p>But Content Templates can actually be used on any content type and allows modification of the teaser and body properties before they go out in an RSS feed or are handed off to the theme.</p>

<h3>Creating templates</h3>

<p>Enter PHP code similar to <a href="http://drupal.org/node/11816">PHPTemplate</a>. The main difference is that you only have access to the $node object. However, PHPTemplate templates only affect output to the page. Contemplate affects display in all site themes as well as RSS feeds and search results.</p>

<h3 id="disk-based">Disk-based templates</h3>
<p>It is also possible to create disk-based template files. To do this, copy the contents of a contemplate textarea and paste it into a file called "node-<em>nodetype</em>-<em>field</em>.tpl.php" where <em>nodetype</em> is the content type and <em>field</em> is either "body", "teaser", or "rss". It is also possible to create a template called "node-<em>nodetype</em>.tpl.php" which will affect all cases, and "node.tpl.php" which will affect all node types.</p>

<p>Place these files into a directory called "contemplates" inside of either your "sites/all" directory or "sites/<em>yoursite</em>" depending on your setup. It is also possible to have multiple "contemplate" directories with "sites/all/contemplates" being the fallback for templates the contemplate does not find in the more specific site directory.</p>

<p>When adding or removing template files, you will need to visit the <a href="!link">Content Templates admin page</a> to refresh the template list cache. You do not need to do this again when making changes to the content of the templates.</p>
', array(
        '!link' => url('admin/content/templates'),
      ));
  }
}