Quote:
Originally Posted by 01100001
My code blocks were missing li tags, here's me fixing that (not that it helped my situation, but it helps keep things clear):
Code:
program:
before = '<ul>';
after = '</ul>';
j = '';
for i in 'tags':
j += '<li>' + i + '</li>';
rof;
before + j + after;
Code:
program: before = '<ul>'; after = '</ul>'; j = ''; for i in 'tags': j += '<li>' + i + '</li>'; rof; before + j + after;
I have also tried using field('tags') (instead of 'tags') and strcat(before, j, after); (instead of before + j + after;) in my code. Still same error.
|
Probably isn't exactly the same error.
You have several problems:
- The template language doesn't contain the += operator.
- The string concatenation operator is & not +.
- 'tags' is a constant string. You should use $tags, field('tags'), or raw_field('tags').
- Semicolons are statement separators, not terminators. For example, using a semicolon before rof or fi is an error. It is an error to put one at the end of the program, but tolerated.
Here is a corrected version:
Code:
program:
before = '<ul>';
after = '</ul>';
j = '';
for i in $tags:
j = j & '<li>' & i & '</li>'
rof;
before & j & after
Comment: I don't see the point of the before and after variables. Why not do
Code:
program:
j = '';
for i in $tags:
j = j & '<li>' & i & '</li>'
rof;
'<ul>' & j & '</ul>'