Any idea why this block of code renders like the i...
# general
s
Any idea why this block of code renders like the image in the comment? trying to put all my content in one table
<#if record.item?has_content>
<#list record.item as item> <tr> <td
_colspan_="10">${item.item@label}</td>
<td align=“left”
_colspan_="3">${item.quantity@label}</td>
<td
_colspan_="3">${item.rate@label}</td>
<td align=“left”
_colspan_="4">${item.amount@label}</td>
<td align=“left”
_colspan_="6">${record.currency@label}</td>
<td align=“right”
_colspan_="4">1</td>
</tr> <tr> <td
_colspan_="10"><span _class_="itemname">${item.item}</span><br />${item.description}</td>
<td align=“left”
_colspan_="3" _line-height_="150%">${item.quantity}</td>
<td
_colspan_="3">${item.rate}</td>
<td align=“left”
_colspan_="4">${item.amount}</td>
<td align=“left”
_colspan_="6">${record.currency}</td>
<td align=“right”
_colspan_="4">1</td>
</tr> </#list> </#if>
message has been deleted
c
You're putting the header in the loop. It needs to be outside it.
s
the label? even if they are in td?
c
Assuming you meant the repeating header, you haven't said
s
yes the header… i was actually trying to mimic the same block of code from the standard and it looks like this where the header is inside the list tag
c
Yeah, move that block to above the list
s
on it
soooo, it throws an error
c
Oh, durr, I'm a muppet, I forgot there were item references in there for the labels. You need to do 1 list above that checks for row 0 to do the headers
I think you shared some similar code the other day that did that (I told you how to add a column I think?)
j
@Schwifty can you repost with your change?
s
@CD fairly new to this, how do you go about that checking for row 0? i just joined earlier today…. @jen not working yet
j
<#if item_index==0>
1
s
so quick backstory, I was able to achieve what i wanted before by putting everything in one table but the problem with that is if the transaction has 3 lines, it would print 3 pages with each line item on it
s
so I am now back to trying to do it again but starting with the items loop and then add rows above and below it for the subtotal and the bill/ship to address
will check @CD thank you as well @jen!
j
Copy code
<table>
	<#list record.item as item>
	<#if item_index==0>
	<thead>
		<tr>
			<th>${item.item@label}</th>
			...etc
		</tr>
	</thead>
	</#if>
	<tr>
		<td>${item.item}</td>
		...etc
	</tr>
	</#list>
</table>
something like that
s
i removed the thead tag on my table since it errors out if I had a couple of td above it…. in my case bill to ship to and other details are above my table and the item list is in the middle
will try the itemindex code but without thead, the standard have those I just removed them my bad
j
right
s
brilliant! that worked. silly me. appreciate the help!!
j
all good! The templating stuff is a bit of a bugbear
s
yeah i totally agree, it’s a first for me to work on these and the error logging does not help most of the time.
j
the errors are extra cryptic