Home Sign up Features Members Forums Control menu Search
Upsaid templates tutorials

Archives Main pages - step one: Building the "Entry" templates

The "Entry template" is the short html code inside which is displayed the content of an entry. Following is a step-by-step exampls of how this template can be built. The first thing we do is include the entry's body. In order to do so, we simply type the !!body!! variable at the exact place we want the entry's body to be displayed.

In our example, we will be using html tables:

<table width="400" bgcolor="#D0F0EB">
    <tr><td>!!body!!</td></tr>
</table>
Now we will add some information about this entry, such as the title (!!title!!) of the entry and the time it has been posted. The time and date can be formatted in many different ways using the appropriate variables. Here is a basic example:
<table width="400" bgcolor="#D0F0EB">
    <tr><td><u>!!title!!</u></td></tr>
    <tr><td>!!body!!</td></tr>
    <tr><td align="right">Posted at !!hours12!!:!!minutes!! !!ampm!!</td></tr>
</table>
Let's now add another important element of the Entry template: the link to this entry's "Entry page". This will allow your visitors to view and post comments on this entry. The url (address) for this "Entry page" is displayed using the !!comurl!! variable:
<table width="400" bgcolor="#D0F0EB">
    <tr><td><u>!!title!!</u></td></tr>
    <tr><td>!!body!!</td></tr>
    <tr><td align="right">Posted at !!hours12!!:!!minutes!! !!ampm!!</td></tr>
    <tr><td align="right"><a href="!!comurl!!">Comment this entry</a></td></tr>
</table>
Here is what our example looks like so far:
This is a title
This is the entry body.
Posted at 2:37 pm
Comment this entry
The next step is to add support for "extended entries". The first thing to do is to add the !!more_link!! variable right after the !!body!! variable:
<table width="400" bgcolor="#D0F0EB">
    <tr><td><u>!!title!!</u></td></tr>
    <tr><td>!!body!!!!more_link!!</td></tr>
    <tr><td align="right">Posted at !!hours12!!:!!minutes!! !!ampm!!</td></tr>
    <tr><td align="right"><a href="!!comurl!!">Comment this entry</a></td></tr>
</table>
This variable include the "More link" template if the entry has an extended body. You will now edit this "More link" template by adding the html link leading to the Entry page. Here is what you could type in this field:
<br /><br />
<a href="!!comurl!!">More...</a>
And here is what our example now looks like:
This is a title
This is the entry body.

More...
Posted at 2:37 pm
Comment this entry
Now, since we will include this template inside another table later, we need to add a <tr><td> at the begining, and a </td></tr> at the end of your code:
<tr><td><table width="400" bgcolor="#D0F0EB">
    <tr><td><u>!!title!!</u></td></tr>
    <tr><td>!!body!!</td></tr>
    <tr><td align="right">Posted at !!hours12!!:!!minutes!! !!ampm!!</td></tr>
    <tr><td align="right"><a href="!!comurl!!">Comment this entry</a></td></tr>
</table></td></tr>
Voilą, you're done with the "Entry Template(s)"!

Intelligent comments counter:

You may also display the amount of comments that have been posted for the entry with the help of the !!showcount!! variable. Thanks to this variable, you will be able to display different mesages according to the amount of comments which have been posted. (i.e. "one note" or "5 notes")

In order to edit the content of this variable, you will need to head to the "Entry Page templates" section of the control menu. At the bottom of that page, you will find the "Comments counter templates", which are composed of three smaller text fields.

In the "0 comment" template, insert for example something like: There is zero comment ...

... in the "1 comment" template, insert something like: There is one comment ...

... and in the "More than 1 comment" template, insert something like: There are !!comcount!! comments

The !!comcount!! variable will display the amount of comments posted on this entry as a simple number. If you wish to have the amount of posted comments displayed in a textual form (i.e. "seven"), you may use the !!comcount_alpha_up!! or !!comcount_alpha_low!! variables instead.

Now, back to our Entry template example, let's replace "Comment this entry" with the !!showcount!! variable:
<tr><td><table width="400" bgcolor="#D0F0EB">
    <tr><td><u>!!title!!</u></td></tr>
    <tr><td>!!body!!</td></tr>
    <tr><td align="right">Posted at !!hours12!!:!!minutes!! !!ampm!!</td></tr>
    <tr><td align="right"><a href="!!comurl!!">!!showcount!!</a></td></tr>
</table></td></tr>
Our entry will now look like this:
This is a title
This is the entry body.
Posted at 2:37 pm
There is one comment
Or, if several entries have been posted:
This is a title
This is the entry body.
Posted at 2:37 pm
There are 3 comments
© Upsaid.com, 2001 - 2003 Contact us - Privacy policy - Terms of use