Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-27319

Sample Twig code for ride.html.twig seems cut and paste error

    XMLWordPrintable

Details

    Description

      In https://doc.ez.no/display/DEVELOPER/Step+1+-+Display+content+of+a+Ride#Step1-DisplaycontentofaRide-AddthePointOfInterestintheRidefullview the code for ride.html.twig is not correct. I think it just got copied and pasted from the code point_of_interest.html.twig from above in the tutorial page. It "does something" since it turns out that there is a "photo" field for the ride, so we see the image attached to the ride, but not the list of points of interests (with their photos) attached to the ride.

      I was looking for a loop, and searching I found: http://qiita.com/bezeklik/items/def8aec31fab890316f1

      So I extracted what I thought was needed and it worked:

      /app/Resources/views/full/ride.html.twig
          {# Displaying Points of interest, injected via RideController.php, viewRideWithPOIAction function #}
          {% for point in pointOfInterestList %}
              {% if loop.first %}
                  <section class="photos">
                  <div class="container">
                  <div class="row regular-content-size">
                  <div class="col-xs-10 col-xs-offset-1" id="wrapper">
                  <div class="col-xs-12">
                      <h4 class="underscore-green">Points of interest:</h4>
                  </div>
              {% endif %}
      
              {{ render( controller( "ez_content:viewLocation", { 'locationId': point.contentInfo.mainLocationId, 'viewType': 'line'} )) }}
      
              {% if loop.last %}
                  </div>
                  </div>
                  </div>
                  </section>
              {% endif %}
          {% endfor %} 
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            benoit.dubuc benoit.dubuc
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: