Gossamer Forum
Quote Reply
tag question
This is a question I posted earlier, but I figured I would repost it as a main thread to see if I can get anyone to reply.

If in my category template I have something like this:

<%loop links_loop%>
<%Links::SiteHTML::display("link", $question_variable)%>
<%endloop%>

What do I replace $question_variable with so that I can import the record to the template?

I would think it would be something like "$links_loop->{0}", but that doesn't work.

Any ideas?


Note:

I realize I can just use an include to accomplish the regular method, but this for something else.

- Jonathan
Quote Reply
Re: [jdgamble] tag question In reply to
With the current version of GT::Template, you won't be able to get at the hash itself. However, we made the change in the next release that you'll be able to access the hash through $loop_value.

Adrian
Quote Reply
Re: [brewt] tag question In reply to
If <%links_loop%> is an array loaded into the memory, it doesn't make sense to me why you can't access it by $links_loop->{0} etc. According to the current version of GT::Template, include will somehow automatically load the part of the array you are working on. I don't understand why it doesn't work.

- Jonathan
Quote Reply
Re: [jdgamble] tag question In reply to
links_loop is an array reference of hash references, therefore individual attributes cannot be accessed with $links_loop->{0}, but more importantly than that, you are attempting to use perl code inside a html template.

GT::Template provides loop functionality with specific syntax and doesn't allow you to use general perl syntax that you'd commonly use within a normal perl script.