Help?

default forms

From Textpattern CMS User Documentation

Contents

Article Forms

article_listing

<txp:if_first_article><ul id="article-list"></txp:if_first_article>
  <li role="article" itemscope itemtype="http://schema.org/Article">
    <h4 itemprop="name"><a href="<txp:permlink />" itemprop="url"><txp:title /></a></h4>

<!-- if the article has an excerpt, display that -->
    <txp:if_excerpt>
      <div itemprop="description">
        <txp:excerpt />
      </div>
    </txp:if_excerpt>

    <p class="footnote"><txp:text item="posted" /> <time datetime="<txp:posted format='iso8601' />" itemprop="datePublished"><txp:posted /></time>, <txp:text item="author" /> <span itemprop="author"><txp:author link="1" this_section="1" /></span></p>
  </li>
<txp:if_last_article></ul></txp:if_last_article>

comments_display

<!-- added an id attribute to the section so we can link directly to here e.g. http://mysite.com/section/article#comments-head -->

<section id="comments-head">

<h3><txp:text item="comments" /></h3>

<!-- if there are comments, display them (note: example code below overrides the global preference setting for comments wrapping by stating
  attributes of wraptag="" and break="", you are instead using ol and li tags below)... -->
<txp:if_comments>
  <ol class="comments-list" itemscope itemtype="http://schema.org/UserComments">

    <txp:comments wraptag="" break="li" /> <!-- links by default to form: 'comments.comment.txp' unless you specify a different form -->

  <!-- if this is a comment preview, display it (but only if there is no error) -->
    <txp:if_comments_preview>
      <li>
        <p id="cpreview"><txp:text item="press_preview_then_submit" /></p>
        <txp:comments_preview wraptag="" /> <!-- links by default to form: 'comments.comment.txp' unless you specify a different form -->
      </li>
    </txp:if_comments_preview>

  </ol>

<txp:else />

<!-- else if there are no comments and if user is currently previewing comment,display it (but only if there is no error) -->
  <txp:if_comments_preview>
    <ol class="comments-list" itemscope itemtype="http://schema.org/UserComments">
      <li>
        <p id="cpreview"><txp:text item="press_preview_then_submit" /></p>
        <txp:comments_preview wraptag="" /> <!-- links by default to form: 'comments.comment.txp' unless you specify a different form -->
      </li>
    </ol>

  <txp:else />

<!-- else just display that there are simply no comments whatsoever :( ...but only if comments are allowed -->
    <txp:if_comments_allowed>
      <p><txp:text item="no_comments" /></p>
    </txp:if_comments_allowed>

  </txp:if_comments_preview>

</txp:if_comments>

<!-- if new comments are allowed for this article then display comment form, if not then display 'closed' messages -->
<txp:if_comments_allowed>
  <section id="comments-form">

    <!-- comment invite text is taken for the article's comment invitation field on the 'write' screen -->
    <h3><txp:comments_invite showcount="0" textonly="1" showalways="1" /></h3>

    <txp:comments_form isize="32" msgcols="64" msgrows="4" /> <!-- links by default to form: 'comment_form.comment.txp' unless you specify a different form -->
  </section>

<txp:else />
  
  <!-- display either a comments expired message or a comments disabled message -->
  <txp:if_comments>
    <p><strong><txp:text item="comments_expired" /></strong></p>
  <txp:else />
    <p><strong><txp:text item="comments_closed" /></strong></p>
  </txp:if_comments>
</txp:if_comments_allowed>

</section>

default

<article role="article" itemscope itemtype="http://schema.org/Article">

<!-- if not an individual article then make the title h1 a link -->
<txp:if_individual_article>
  <h1 itemprop="name"><txp:title /></h1>
<txp:else />
  <h1 itemprop="name"><a href="<txp:permlink />" itemprop="url"><txp:title /></a></h1>
</txp:if_individual_article>

  <p><strong><txp:text item="posted" /></strong> <time datetime="<txp:posted format='iso8601' />" itemprop="datePublished"><txp:posted /></time><br>
    <strong><txp:text item="comments" /></strong> <a href="<txp:permlink />#comments-head" title="<txp:text item='view' />…" itemprop="discussionUrl" itemscope itemtype="http://schema.org/UserComments">

<!-- if comments then display the number, if no comments then print 'none' -->
<txp:if_comments>
  <span itemprop="interactionCount"><txp:comments_count /></span>
<txp:else />
  <span itemprop="interactionCount"><txp:text item="none" /></span>
</txp:if_comments>

  </a></p>

  <div itemprop="articleBody">
    <txp:body />
  </div>

  <p><strong><txp:text item="author" /></strong> <span itemprop="author"><txp:author link="1" this_section="1" /></span>

<!-- only display categories if they are actually set for an article, otherwise omit -->
  <txp:if_article_category>
    <br><strong><txp:text item="categories" /></strong> <span itemprop="keywords"><txp:category1 title="1" link="1" /><txp:if_article_category number="1"><txp:if_article_category number="2">, </txp:if_article_category></txp:if_article_category><txp:category2 title="1" link="1" /></span>
  </txp:if_article_category>

  </p>

<!-- if this is an individual article then add the comments section via form: comments_display.article.txp -->
<txp:if_individual_article>
  <txp:article form="comments_display" />
</txp:if_individual_article>

</article>

search_results

<txp:if_search>

<!-- count how many results return -->
  <txp:article limit="10" pgonly="1" />

  <txp:if_search_results>

<!-- if search result count greater than 200 then display excessive results message, otherwise show search result count -->
    <txp:if_search_results max="200">
      <h3><txp:search_result_count /> <txp:text item="matching_search_request" /> ‘<txp:search_term />’…</h3>
    <txp:else />
      <h3><txp:text item="too_common_search_term" /> ‘<txp:search_term />’</h3>
    </txp:if_search_results>

<!-- if no search results, then display no search results message -->
  <txp:else />
    <h3><txp:text item="no_search_matches" /></h3>

  </txp:if_search_results>

<!-- display resulting articles (10 per page) -->
  <txp:article limit="10">

    <txp:if_first_article><ul id="article-list"></txp:if_first_article>
      <li role="article" itemscope itemtype="http://schema.org/Article">
        <h4 itemprop="name"><a href="<txp:permlink />" itemprop="url"><txp:title /></a></h4>

<!-- if the article has an excerpt, display that, otherwise show highlighted keywords in context of article -->
        <txp:if_excerpt>
          <div itemprop="description">
            <txp:excerpt />
          </div>
        <txp:else />
          <p><txp:search_result_excerpt /></p>
        </txp:if_excerpt>

        <p class="footnote"><txp:text item="posted" /> <time datetime="<txp:posted format='iso8601' />" itemprop="datePublished"><txp:posted /></time>, <txp:text item="author" /> <span itemprop="author"><txp:author link="1" this_section="1" /></span></p>
      </li>
    <txp:if_last_article></ul></txp:if_last_article>

  </txp:article>

<!-- check if there are further results and provide pagination links or disabled buttons depending on the result,
  this method is more flexibile than using simple txp:older/txp:newer tags -->
  <txp:if_search_results min="11">

    <p id="paginator">

    <txp:variable name="prev" value='<txp:older />' />
    <txp:variable name="next" value='<txp:newer />' />

    <txp:if_variable name="next" value="">
      <span id="paginator-l" class="button disabled">← <txp:text item="prev" /></span>
    <txp:else />
      <a id="paginator-l" href="<txp:newer />" title="← <txp:text item="prev" />" class="button">← <txp:text item="prev" /></a>
    </txp:if_variable>
    <txp:if_variable name="prev" value="">
      <span id="paginator-r" class="button disabled"><txp:text item="next" /> →</span>
    <txp:else />
      <a id="paginator-r" href="<txp:older />" title="<txp:text item="next" /> →" class="button"><txp:text item="next" /> →</a>
    </txp:if_variable>

    </p>

  </txp:if_search_results>

</txp:if_search>

Miscellaneous

images

<!-- set up a variable to check whether a image also has a caption associated with it... -->
<txp:variable name="caption" value='<txp:image_info type="caption" />' />

<!-- ...now use that image caption and wrap img inside a figure with figcaption tags, otherwise just use a plain img tag -->
<txp:if_variable name="caption" value="">

<!-- image - overriding the width and height to let the image scale to fit parent container -->
  <p><txp:image width="0" height="0" /></p>

<txp:else />

  <figure itemscope itemtype="http://schema.org/ImageObject">

<!-- image - overriding the width and height to let the image scale to fit parent container -->
    <txp:image width="0" height="0" />

<!-- you do not need to specify the attribute type="caption" as that is the default setting for <txp:image_info /> tag -->
    <figcaption itemprop="caption"><txp:image_info type="caption" /></figcaption>

  </figure>

</txp:if_variable>

search_input

<form role="search" method="get" action="<txp:site_url />">
  <h4><label for="search-textbox"><txp:text item="search" /></label></h4>
  <p><input id="search-textbox" type="search" name="q"<txp:if_search> value="<txp:search_term />"</txp:if_search>><input type="submit" value="<txp:text item='go' />"></p>
</form>

Comment Forms

comments

<!-- load the comment email into a variable. you will be using below this along with author email variable loaded in form: default.article.txp
  then check the comment email variable against article author email variable, and if it matches add 'comments-author' class -->
<txp:variable name="this_comment" value='<txp:comment_email />' />
<txp:if_variable name="this_comment" value='<txp:author_email />'>
  <article class="comments comments-author" itemprop="comment">
<txp:else />
  <article class="comments" itemprop="comment">
</txp:if_variable>

  <h4>

  <span itemprop="creator"><txp:comment_name /></span>

  <!-- ...now check the comment email variable against article author email variable, and if it matches add '(author)' text -->
  <txp:if_variable name="this_comment" value='<txp:author_email />'>
    <span class="is-author">(<txp:text item="author" />)</span>
  </txp:if_variable>

  <!-- add a permlink so people can link direct to this comment -->
    <span class="comment-anchor" itemprop="url"><txp:comment_permlink>#</txp:comment_permlink></span>

  </h4>

  <!-- also add a 'since' to show comment freshness -->
  <p class="footnote"><time datetime="<txp:comment_time format='iso8601' />" itemprop="commentTime"><txp:comment_time /> (<txp:comment_time format="since" />)</time></p>

  <div itemprop="commentText">
    <txp:comment_message />
  </div>

</article>

comment_form

<txp:comments_error wraptag="ul" break="li" />

<p><txp:text item="enter_comment_here" /></p>

<!-- if there is an error, then inform user -->
<txp:if_comments_error>
  <txp:comments_error wraptag="ol" break="li" class="error_message" />
</txp:if_comments_error>

<fieldset>

  <p class="large"><label for="name"><txp:text item="comment_name" /> <b class="required">*</b></label><br>
  <txp:comment_name_input /></p>

  <p class="large"><label for="email"><txp:text item="comment_email" /> <b class="required">*</b></label><br>
  <txp:comment_email_input /></p>

  <p class="large"><label for="web"><txp:text item="comment_web" /></label><br>
  <txp:comment_web_input /></p>

  <p><txp:comment_remember /></p>

  <p class="small"><label for="message"><txp:text item="comment_message" /> <b class="required">*</b></label><br>
  <txp:comment_message_input /></p>

</fieldset>

<!-- preview and submit buttons (note: submit button will have a class of 'disabled' applied until you have previewed the message at least once) -->
<p><txp:comment_preview /> <txp:comment_submit /></p>

popup_comments

<!doctype html>
<html lang="<txp:lang />">

<head>
  <meta charset="utf-8">

  <title><txp:page_title /></title>
  <meta name="generator" content="Textpattern CMS">
  <meta name="robots" content="noindex, follow, noodp, noydir">

<!-- mobile viewport optimised, more info: http://h5bp.com/viewport -->
  <meta name="viewport" content="width=device-width, initial-scale=1">

<!-- css -->
  <!-- Google font API (remove this if you intend to use the theme in a project without internet access) -->
  <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Serif:n4,i4,n7,i7|Cousine">

  <txp:css format="link" media="" />
  <!-- or you can use (faster) external CSS files eg. <link rel="stylesheet" href="<txp:site_url />css/default.css"> -->

<!-- HTML5/Media Queries support for IE < 9 (you can remove this section and the corresponding 'js' directory files if you don't intend to support IE < 9) -->
  <!--[if lt IE 9]>
    <script src="<txp:site_url />js/html5shiv.js"></script>
    <script src="<txp:site_url />js/css3-mediaqueries.js"></script>
  <![endif]-->

</head>

<body id="popup-page">

  <div class="wrapper">
    <div class="container">

      <!-- this form is only used if you set 'Comments mode' to 'popup' format in preferences -->
      <txp:popup_comments />

    </div> <!-- /.container -->
  </div> <!-- /.wrapper -->

</body>
</html>

File Forms

files

<!-- set up a variables to check whether a file also has a title, description, category associated with it... -->
<txp:variable name="file_download_title" value='<txp:file_download_name title="1" />' />
<txp:variable name="file_download_description" value='<txp:file_download_description />' />
<txp:variable name="file_download_category" value='<txp:file_download_category />' />

<div itemscope itemtype="http://schema.org/userDownloads">

  <!-- ...if exists, use the file title, otherwise use file name -->
  <txp:if_variable name="file_download_title" value="">
    <strong itemprop="name"><a href="<txp:file_download_link />" title="<txp:file_download_name />" itemprop="url"><txp:file_download_name /></a></strong><br>
  <txp:else />
    <strong itemprop="name"><a href="<txp:file_download_link />" title="<txp:file_download_name title='1' />" itemprop="url"><txp:file_download_name title="1" /></a></strong><br>
  </txp:if_variable>

  <!-- ...if exists, use the file description, otherwise omit that line -->
  <txp:if_variable name="file_download_description" value="">
  <txp:else />
  <span itemprop="description"><txp:file_download_description /></span><br>
  </txp:if_variable>

  <span class="footnote">

  <!-- ...if exists, use the file category, otherwise omit that line -->
  <txp:if_variable name="file_download_category" value="">
  <txp:else />
    <strong><txp:text item="category" /></strong> <txp:file_download_category /> | 
  </txp:if_variable>

    <strong><txp:text item="author" /></strong> <txp:file_download_author link="1" /> | 
    <strong><txp:text item="file_size" /></strong> <txp:file_download_size /> | 
    <strong><txp:text item="last_modified" /></strong> <span itemprop="dateModified"><txp:file_download_created /></span> | 
    <strong><txp:text item="download_count" /></strong> <span itemprop="interactionCount"><txp:file_download_downloads /></span>

  </span>

</div>

Link Forms

plainlinks

<!-- This is being used as an external links form, therefore rel is set to 'external' -->
<txp:linkdesctitle rel="external" />
Translations [?]