Forum

Thread tagged as: Problem, Discussion

Empty "src" property in tag output in template

First, I'm posting on behalf of my employer's license. My employer bought a license for Perch, and I directed the process of setting up my employer's account in her name. However, I'm uncomfortable communicating under my employer's name, so I created my own account to ask for support on the forum, even though I don't personally own a license. Please help me anyways.

I tried to follow the specification in the image field type specification, but my image tags have an empty src attribute. On the rendered page, the alt texts appear instead of the images.

In the dashboard, I am able to upload the images, and those images have indeed been placed in the /perch/resources/ directory, so I think the problem is the way the perch tag is being rendered. I would guess this is probably a simple templating mistake, as I'm still quite new to the system.

My template:

<div class="module-photobar">
  <div class="component-ui_image">
    <img src="<perch:content id="photobar-top" type="image" label="Decorative photo of the facilities, land, or rooms at the Lake House">" alt="<perch:content id="photobar-top-alt" type="text" label="What is this photo about?" />" />
  </div>
  <div class="component-ui_image">
    <img src="<perch:content id="photobar-middle" type="image" label="Decorative photo of the facilities, land, or rooms at the Lake House">" alt="<perch:content id="photobar-middle-alt" type="text" label="What is this photo about?" />" />
  </div>
  <div class="component-ui_image">
    <img src="<perch:content id="photobar-bottom" type="image" label="Decorative photo of the facilities, land, or rooms at the Lake House">" alt="<perch:content id="photobar-bottom-alt" type="text" label="What is this photo about?" />" />
  </div>
</div>

I tried converting the double quote marks inside the perch tag into single quotes in order to understand more clearly what is inside what property of what, but that totally broke the template's fields in the dashboard.

Thank you.

Paul Lee

Paul Lee 0 points

  • 5 years ago

IDs should be letters, numbers or underscores only, and your image fieldtype is missing a closing slash. This should fix it:

<perch:content id="photobar_top" type="image" label="Decorative photo of the facilities, land, or rooms at the Lake House" />
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Hi Paul

as Shane has explains you have errors in your template tags. If you need further help then we need you to post your Diagnostics Report - this should be included with each post to the forum.