Skip to content

Instantly share code, notes, and snippets.

@low
Created June 5, 2012 14:20
Show Gist options
  • Save low/2875302 to your computer and use it in GitHub Desktop.
Save low/2875302 to your computer and use it in GitHub Desktop.
Low Reorder 1 documentation
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Meta -->
<meta charset="utf-8" />
<meta name="author" content="Lodewijk Schutte | Low" />
<meta name="description" content="go to Low, for Expressionengine Add-ons" />
<title>Low Reorder 1 Documentation</title>
<style>
body {
max-width:800px;
font:14px/1.5 arial, sans-serif;
}
h1, h2, h3, h4 {
font-family:georgia, serif;
}
pre {
overflow:auto;
padding:1.5em;
background:#ffe;
}
table {
width:100%;
margin-bottom:1.5em;
}
th {
text-align:left;
}
.var {
width:25%;
}
caption {
color:#888;
font-style:italic;
text-align:left;
}
tbody td {
border-top:1px solid #eee;
}
code {
font:12px/1.5 'consolas', 'monaco', monospace;
background:#ffe;
}
</style>
</head>
<body>
<h1>Low Reorder 1 Documentation<h1>
<h2 id="compatibility">Compatibility &amp; Requirements</h2>
<p>
Low Reorder is compatible with <strong>EE 1.6.8+</strong> and <strong>EE 2.0.1+</strong>.
The EE1 version also requires <a href="http://pixelandtonic.com/fieldframe">FieldFrame</a>
and the <a href="http://expressionengine.com/index.php?affiliate=lodewijk&amp;path=downloads/details/jquery_for_the_control_panel">jQuery extension</a>
to be enabled.
</p>
<h2 id="installation">Installation</h2>
<h3>ExpressionEngine 2</h3>
<ul>
<li>Download and unzip Low Reorder</li>
<li>Copy the <code>ee2/low_reorder</code> folder to your <code>/system/expressionengine/third_party/</code> directory</li>
<li>In your Control Panel, go to Add-Ons &rarr; Modules and click the Install-link in the Low Reorder row</li>
<li>Select to install both the Low Reorder fieldtype and module</li>
</ul>
<h3>ExpressionEngine 1</h3>
<ul>
<li>Download and unzip Low Reorder</li>
<li>Copy the <code>ee1/system/extensions/fieldtypes/low_reorder_ft</code> folder to your <code>system/extensions/fieldtypes</code> directory</li>
<li>Copy the <code>ee1/system/modules/low_reorder</code> folder to your <code>system/modules</code> directory</li>
<li>In your Control Panel, go to Admin &rarr; Utilities &rarr; Fieldtypes Manager and enable the Low Reorder fieldtype</li>
<li>In your Control Panel, go to Modules install the Low Reorder module</li>
</ul>
<h2 id="setup">Setup</h2>
<p>
Once installed, you need to create a new custom field. The installation created a new type: Low Reorder.
If you assign such a custom field to a channel, you&rsquo;ll be able to sort entries in that channel using
that field. You can add multiple Low Reorder fields to a single channel, allowing for different orders.
</p>
<p>
After assigning Low Reorder fields to your channels, you&rsquo;ll find them on the module page. Click Edit
settings to change filter settings for that channel/field pair. Click Reorder entries to start reordering.
</p>
<h2 id="upgrade">Upgrade</h2>
<p>
To upgrade Low Reorder from a previous version, download and overwrite the files as per the installation instructions.
Then just visit the module page in your Control Panel, and the add-on will be upgraded automatically.
</p>
<h2>Settings</h2>
<p>
By default, all entries in given channel will be listed. Per channel/field combination, you can filter
these entries by Category, Status, Expired entries and Future entries. You can also choose to display
sortable entries per category, which works best if you make sure an entry is put in <em>just one</em> category.
</p>
<p>
Setting the sort order to Ascending (default) reflects to the <code>sort="asc"</code> parameter in the
<code>{exp:channel:entries}</code> tag. Like this, new entries will appear at the bottom of the list.
Setting the sort order to Descending will add new entries on top of the list and requires you to use
<code>sort="desc"</code> in your <code>{exp:channel:entries}</code> tag. An example of the
<code>{exp:channel:entries}</code> opening tag will be displayed for the selected settings.
</p>
<p>
Per member group, you can choose whether members of that group can both access the settings and reorder
entries or just reorder the entries. You can also hide a channel/field combination from that member group.
</p>
<h2>Reordering</h2>
<p>
The list of entries can be reordered using Drag and Drop. Field Instructions for your Low Reorder field will
be shown above the list. Be sure to save the new order when you&rsquo;re done.
</p>
<h2>Template tags</h2>
<p>
To display the desired order, you need to tell the <code>&#123;exp:channel:entries&#125;</code>
tag to order by the Low Reorder field you want. Make sure you don&rsquo;t disable the custom fields.
Also, the filter settings (like status and categories) must be reflected in your tag parameters. For example:
</p>
<pre><code>&#123;exp:channel:entries channel="services" status="open|featured" orderby="low_reorder_field" sort="asc"&#125;
&lt;!-- more code here --&gt;
&#123;/exp:channel:entries&#125;</code></pre>
<p>If you&rsquo;re using the Low Reorder custom field in your templates, you can use the parameter <code>padding=""</code> to add a maximum amount of leading zeroes to its value. For example:</p>
<pre><code>{low_reorder_field padding="1"}</code></pre>
<p>This will output <code>01</code>, <code>02</code>, <code>03</code>... etc. If the parameter is omitted, no leading zeroes will be added.</p>
<h2>Previous and Next Entry</h2>
<p>In most cases, the above code will suit your needs best. In addition to this, there are a couple of template tags you can use.</p>
<ul>
<li><code>&#123;exp:low_reorder:next_entry&#125;</code></li>
<li><code>&#123;exp:low_reorder:prev_entry&#125;</code></li>
</ul>
<p>Use these tags to show either the next or previous entry of your reordered entries. These tags work a bit like <a href="http://expressionengine.com/user_guide/modules/channel/entry_linking.html">their Channel module relatives</a>.</p>
<table>
<caption>Parameters for &#123;exp:low_reorder:prev_entry&#125; and &#123;exp:low_reorder:next_entry&#125; tag pairs</caption>
<colgroup>
<col class="var" />
<col />
</colgroup>
<thead>
<tr>
<th scope="col">Parameter</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>field</code></td>
<td>The name of your Low Reorder custom field. <em>This is a required field.</em></td>
</tr>
<tr>
<td><code>entry_id</code></td>
<td>Entry id of the current entry. If not defined, you <em>must</em> define the <code>url_title</code>.</td>
</tr>
<tr>
<td><code>url_title</code></td>
<td>Url title of the current entry. If not defined, you <em>must</em> define the <code>entry_id</code>.</td>
</tr>
<tr>
<td><code>category</code></td>
<td>Category id of the current entry. Use in combination with ordered entries that are put in a single category.</td>
</tr>
<tr>
<td><code>loop</code></td>
<td>If set to <code>yes</code>, the entry lookup will work in a loop, returning the first one when viewing the last and vice versa.</td>
</tr>
<tr>
<td><code>prefix</code></td>
<td>If defined, tag variables will be prefixed with given prefix. Useful for nesting inside the <code>&#123;exp:channel:entries&#125;</code> tag.</td>
</tr>
<tr>
<td><code>no_results</code></td>
<td>If defined, the tag will return its value when there&rsquo;s no previous or next entry. This value will override the <code>&#123;if no_results&#125;</code> conditional.</td>
</tr>
</tbody>
</table>
<table>
<caption>Variables inside &#123;exp:low_reorder:prev_entry&#125; and &#123;exp:low_reorder:next_entry&#125; tag pairs</caption>
<colgroup>
<col class="var" />
<col />
</colgroup>
<thead>
<tr>
<th scope="col">Variable</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>&#123;entry_id&#125;</code></td>
<td>Entry id of the next/previous entry.</td>
</tr>
<tr>
<td><code>&#123;url_title&#125;</code></td>
<td>Url title of the next/previous entry.</td>
</tr>
<tr>
<td><code>&#123;title&#125;</code></td>
<td>Title of the next/previous entry.</td>
</tr>
</tbody>
</table>
<h3>Examples</h3>
<pre><code>&lt;!-- Not nested: --&gt;
&#123;exp:low_reorder:prev_entry field="low_reorder_field" url_title="&#123;segment_2&#125;" loop="yes"&#125;
Previously: &lt;a href="&#123;path="services/&#123;url_title&#125;"&#125;"&gt;&#123;title&#125;&lt;/a&gt;
&#123;if no_results&#125;This is the first page&#123;/if&#125;
&#123;/exp:low_reorder:prev_entry&#125;
&#123;exp:low_reorder:next_entry field="low_reorder_field" url_title="&#123;segment_2&#125;" loop="yes"&#125;
Next up: &lt;a href="&#123;path="services/&#123;url_title&#125;"&#125;"&gt;&#123;title&#125;&lt;/a&gt;
&#123;if no_results&#125;This is the last page&#123;/if&#125;
&#123;/exp:low_reorder:next_entry&#125;</code></pre>
<pre><code>&lt;!-- Nested: --&gt;
&#123;exp:channel:entries channel="services" url_title="&#123;segment_2&#125;"&#125;
&lt;h1&gt;&#123;title&#125;&lt;/h1&gt;
&#123;service_description&#125;
&#123;exp:low_reorder:prev_entry field="low_reorder_field" entry_id="&#123;entry_id&#125;" prefix="prev_" no_results="This is the first page"&#125;
Previously: &lt;a href="&#123;path="services/&#123;prev_url_title&#125;"&#125;"&gt;&#123;prev_title&#125;&lt;/a&gt;
&#123;/exp:low_reorder:prev_entry&#125;
&#123;exp:low_reorder:next_entry field="low_reorder_field" entry_id="&#123;entry_id&#125;" prefix="next_" no_results="This is the last page"&#125;
Next up: &lt;a href="&#123;path="services/&#123;next_url_title&#125;"&#125;"&gt;&#123;next_title&#125;&lt;/a&gt;
&#123;/exp:low_reorder:next_entry&#125;
&#123;/exp:channel:entries&#125;</code></pre>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment