• Resolved academicwebpages

    (@academicwebpages)


    I want to access {@ems_system.ID} PODS from within the [each] loop:

    <table class="avia-table avia-data-table avia_pricing_default avia-builder-el-1 avia-builder-el-no-sibling ">
    <tbody>
    <tr class="avia-heading-row">
    <th width="20%">MEDICAL DIRECTOR</th>
    <th width="20%">EMS SYSTEM</th>
    <th width="60%">  </th>
    </tr>
    [/before]
    
    <tr class="row-design" >
    	<td class="cell-design">{@medical_director} {@medical_director_last}</td>
    	<td class="cell-design">{@post_title} ({@ID})</td>
    	<td>
    		<table vertical-align="top">
    			<tr>
    			<td width="40%" class="cell-design-hospital">STROKE HOSPITALS SERVED<br>NATIONAL CERTIFICATION</td>
    				<td width="30%" class="cell-design-hospital">STROKE COORDINATOR CONTACT INFO</td>
    				<td width="30%" class="cell-design-hospital">YES ? NO</td>
    			</tr>
    		[each stroke_hospitals_served]
    			<tr>
    			<td width="40%" class="cell-design-hospital"><strong>{@stroke_hospitals_served.post_title} ({@ID})</strong><br>
    				{@stroke_hospitals_served.national_certification}
    				<br> ems_system.@ID is {@ems_system.ID}
    				</td>
    			<td width="30%" class="cell-design-hospital"><strong>{@stroke_hospitals_served.stroke_coordinator}<br>
    				<a href="mailto:{@stroke_hospitals_served.stroke_coordinator_email}">Email</a><br>
    				{@stroke_hospitals_served.stroke_coordinator_phone}</strong>
    			<td width="30%" class="cell-design-hospital">
    
    [gravityform id="18" title="false" description="false" ajax="true" field_values="hospital_slug={@stroke_hospitals_served.ID}&site_shared_code={@stroke_hospitals_served.site_shared_code}" ]
    			</tr>
    	[/each]
    	</table></td>
    
    </tr>
    [after]
    </tbody>
    </table>
    [/after]

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hello @academicwebpages

    {@ems_system} would refer to a field from a {@stroke_hospitals_served} object, correct?
    If not, than this core isn’t the correct syntax.

    Also, I see you added {@stroke_hospitals_served.national_certification}.
    Since you are already in a loop of the stroke_hospitals_served you do not need that prefix anymore.

    More info here: https://docs.pods.io/displaying-pods/template-tags/each-loop-tag/

    Cheers, Jory

    Thread Starter academicwebpages

    (@academicwebpages)

    no i did not explain well. I have TWO custom posts: ems_system and hospital.

    ems_system is a custom post and stroke_hospitals_served is a relationship field in ems_system that points to another custom post (hospital)

    So the [each] loop iterates through all the hospitals pointed to by the stroke_hospitals_served field. While in that [each] loop, I want to know the ID of the ems_system post I am displaying with the template…

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @academicwebpages

    Since the context changes within an [each] loop I don’t think this is possible.
    You’ll need to a bi-directional field or use PHP since we do not yet support storing variables within our templates.
    Note that these templates support basic code operations and are definitely not as flexible as using PHP.

    Cheers, Jory

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘can’t get field value inside [each] loop’ is closed to new replies.