Forums

This topic is locked

Template parameters and expressions

Posted 31 Jan 2007 00:39:50
1
has voted
31 Jan 2007 00:39:50 Trent Claus posted:
Hello,
I am trying to create previous / next buttons on my site using template parameters.

For instance:
In the <head> section I have the parameters set as:

<!-- TemplateParam name="book_name" type="text" value="gunslinger" -->
<!-- TemplateParam name="book_num" type="number" value="1" -->

And in the correct location within the <body> of the template page, I have the expressions entered as:

<a href="@@(book_name + (book_num + 1) + '.htm')@@">NEXT</a>
<a href="@@(book_name + (book_num - 1) + '.htm')@@">PREV</a>

So, on the page gunslinger001.htm the NEXT link shows as:

<a href="gunslinger2.htm">NEXT</a>

The problem is that the resulting <a href> points to a non-existant file because in the addition process it changed from gunslinger001.htm to gunslinger2.htm instead of gunslinger002.htm.

What I need is a way to get the resulting <a href> to include the placeholding 0's.

I am not a programmer (in fact it has taken me many hours to even get this far), but I would think it would be possible to add 'if' statements so that 'if' the parameter book_num is less than 10, it includes two 0's. Likewise, if the book_num parameter value is greater than 9 and less than 100, it would include one 0. Just an idea.

Does anyone have any solutions or ideas?

Thanks!

Replies

Replied 01 Feb 2007 02:35:29
01 Feb 2007 02:35:29 Trent Claus replied:
I've looked everywhere for an answer but have yet to find anything. Anyone have any suggestions?

Edited by - Lobstrosity on 01 Feb 2007 06:45:07

Reply to this topic