I'm trying to wire together a views list full of node titles and the viewscarousel (jCarousel) start position. By passing a start index to my viewscarousel view I can get my carousel to start from the current node instead of from the beginning each time.
Here's some background:
My view outputs an unordered list grouped by taxonomy term. Within each term is a list of node titles. I've modified the views field output via a tpl file so that I can link the node title to specific sections on my site. Heres some pseudo code/output of this view:
<h3>Taxonomy Term1</h3>
<ul>
<li><a href="path/to/someplace/nodetitle_foo"></li>
<li><a href="path/to/someplace/nodetitle_baz"></li>
...etc
</ul>
What I'd like to do is append an index after each node title like so:
<li><a href="path/to/someplace/nodetitle_foo/1"></li>
<li><a href="path/to/someplace/nodetitle_baz/2"></li>
...etc
I'll then grab that index then call jcarousel({start:<?php print arg(2); ?>});
at document.ready.
It would be trivial to add an index at the list.tpl level--the problem is that the custom link I build is in the field tpl file--which knows nothing about how many items there are in the array of results. IOW:
list.tpl.php file:
<?php foreach ($rows as $id=>$row): ?> //I could add $i=1; here...
<li><?php print $row; ?></li>
<?php endforeach; ?> //I could add $i++; before the endforeach; here...
field.tpl.php file:
<a href="path/to/someplace/"><?php print node->title; ?></a> //How can I print $i here??
Any suggestions? This may be one of those obvious solutions that I just can't see..
thx
pp
Comments
Just a bump...hope that's
Just a bump...hope that's OK
Issue
Issue solved:
http://drupal.org/node/354204#comment-1182597