Forum

Thread tagged as: Question, Problem

Unique ID not Generated

Looking at adding a unique ID to various service div's of one page, that I can add to a URL to link to and jump to the respective div i.e. service.html#events1

I've added a shared region that uses a template, html below. I've added the function to create a unique ID on the first div but the output doesn't include the ID, html output is <div id="serv" class="service">

The offending function HTML:

<div id="serv<perch:content id="perch_item_index" type="hidden">" class="service">

Full template html:

<div id="serv<perch:content id="perch_item_index" type="hidden">" class="service">
<div class="col-xs-12 col-sm-12">
<h2><perch:content id="service_name" type="text" label="Name" required="true" title="true" /></h2>
</div>

<div class="col-xs-12 col-sm-3">
<img src="<perch:content type="image" id="service_image_large" label="Square Service Image" />" alt="Taylor Harley financial services, <perch:content type="text" id="service_name" />" class="img-responsive hidden-xs visible-sm visible-md visible-lg" />
<img src="<perch:content type="image" id="service_image_small" label="Rectangular Service Image" />" alt="Taylor Harley financial services, <perch:content type="text" id="service_name" />" class="img-responsive visible-xs hidden-sm hidden-md hidden-lg" />
</div>

<div class="col-xs-12 col-sm-9">
<perch:content id="service_description" type="textarea" label="Service Description" markdown="true" editor="simplemde" required="true" />
<div class="example">
<h3><perch:content id="service_example_title" type="text" label="Panel Text Title" /></h3>
<p><perch:content id="service_example" type="textarea" label="Panel Text" markdown="true" editor="simplemde" /></p>
</div>

<a href="contact_taylor_hartley.php" title="contact Taylor Hartley today" class="btn btn-default">Contact us <span class="hidden-sm hidden-xs"><strong>TODAY</strong> </span>for a free <span class="hidden-xs">inital </span>consultation <span class="glyphicon glyphicon-play" aria-hidden="true"></span></a>
</div>
</div>

Any insight greatly appreciated

Chris Jones

Chris Jones 0 points

  • 3 years ago

what do you see with <perch:showall> in the template. ?

Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Hello Chris,

What version of Perch are you using? If you are not using 3.1 or higher, your tag should be self-closed:

<perch:content id="perch_item_index" type="hidden" />

Hi Hussein, I'm using an earlier version - I've dropped in your self-closed code and it works fine. Many thanks for your help, nice one!

ian hobbs said:

what do you see with <perch:showall> in the template. ?

Hi Ian,

I hadn't used this before but the output is helpful, thanks