Forum

Thread tagged as: Question

href variable

I have built a portfolio with multiple items. There is always a preview image with a link to its full content. How can I set for each item an own link that is referred to its full content?

Here are my templates:

  1. Preview item with link:

<div class="portfolio-item"> <a href="#portfolio1"> <!-- image --> </a> </div>

Should link to:

<div id="portfolio1"> <!-- content --> </div>

Thanks a lot!

Martin Stettler

Martin Stettler 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Is the question how to generate the portfolio1 part?

How to get a unique link for it. «portfolio1» stands for the first item. But I need a variable that every added item gets its unique id. The user should be free in adding as many items as he likes.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

You can use perch_item_index. Look under Special Values on this page.

https://docs.grabaperch.com/docs/templates/attributes/id/

Ok, great it works! Many thanks for your support!