should not be shared without permission. {% if craft.request.segments[1] == 'category' %} {% set title = 'Category' %} {% elseif craft.request.segments[1] == 'tag' %} {% set title = 'Tag' %} {% else %} {% set title = 'Index' %} {% endif %} 9
should not be shared without permission. {% switch craft.request.segments[1] %} {% case 'category' %} {% set title = 'Category' %} ! {% case 'tag' %} {% set title = 'Tag' %} ! {% default %} {% set title = 'Index' %} ! {% endswitch %} 10
should not be shared without permission. {% for entry in craft.entries({ section: 'news' }) %} <article class="news--{{ cycle(['odd', 'even'], loop.index0) }}"> <h2>{{ entry.title }}</h2> {{ entry.summary }} </article> {% endfor %} 12
should not be shared without permission. {% for entry in craft.entries({ section: 'news' }) %}! <article>! <h2>{{ entry.title }}</h2>! {{ entry.summary }}! </article>! {% else %}! <p>Sorry, there is no news for this category.</p>! {% endfor %} 17
should not be shared without permission. {% set announcement = craft.entries({ section: 'announcement', limit: 1}) %} ! {% for entry in announcement %} {{ entry.title }} {% endfor %} 19
should not be shared without permission. {% set announcement = craft.entries({ section: 'announcement', limit: 1}).first() %} ! {{ announcement.title }} 20
should not be shared without permission. <ul> {% for option in craft.fields.getFieldbyHandle('activity').settings.options %} <li><a href="#{{ option.value }}">{{ option.label }}</li> {% endfor %} </ul> 28
should not be shared without permission. {% for entry in craft.entries({ section: 'news', limit: 5 }) %} {% for block in entry.bodyBuilder.type('image') %} ... {% endfor %} {% endfor %} 30
should not be shared without permission. {% for entry in craft.entries({ section: 'news', limit: 5 }) %} {% for block in entry.bodyBuilder.type('video, image').limit(1) %} ... {% endfor %} {% endfor %} 31
should not be shared without permission. {% for i in 1..5 %} <article> <h2><a href="#">Here is the title {{ i }}</a></h2> <p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes. </p> </article> {% endfor %} 34
should not be shared without permission. <select name="subject" id="subject"> <option value="general_inquiries">General Inquiries</option> <option value="order_status">Order Status</option> <option value=“press_media">Press & Media Inquiries</option> <option value="other_contact">Other</option> </select> 35
should not be shared without permission. {% set subjects = { 'General Inquiries' : 'general_inquiries', 'Order Status' : 'order_status', ‘Press & Media Inquiries' : 'press_media', 'Other' : 'other_contact', } %} ! <select name="subject" id="subject"> {% for label, value in subjects %} <option value="{{ value }}">{{ label }}</option> {% endfor %} </select> 36
should not be shared without permission. {% set tag = craft.tags({ name: tag, set: 'news' }).first() %} {% set entries = craft.entries({ section: 'news', limit: 5, relatedTo: tag }) %} 40
should not be shared without permission. {% set allMedia = craft.entries({ section: 'media', limit: null }) %} {% set products = craft.entries({ section: 'product', relatedTo: allMedia }) %} 41
should not be shared without permission. {% set params = { section: 'media', limit: 12, order: 'lft desc' } %} ! {% set entries = craft.entries(params) %} 48
should not be shared without permission. {% set otherVar = 'Oh hai' %} {% include 'shared/_sidebar' with { 'heading' : 'Here is my heading' } only %} 52
should not be shared without permission. {% if entry.listingSection %} {% include '_shared/listing_' ~ entry.listingSection ignore missing %} {% endif %} 53
should not be shared without permission. # page.html ! {% extends '_layout' %} ! {% block content %} Here is the content {% endblock %} ! {% block sidebar %} {{ parent() }} ! Here is some additional sidebar content {% endblock %} 56
should not be shared without permission. Auto-update locally Commit and deploy the files Visit the CP on additional environments DB update process will run UPDATING IN MULTIPLE ENVIRONMENTS 61
should not be shared without permission. # _helpers/index.html ! {%- macro map_link(address) -%} http://maps.google.com/?q={{ address | url_encode }} {%- endmacro -%} 67
should not be shared without permission. {% import "_helpers" as helpers %} ! <a href="{{ helpers.map_link('400 S. Maple Avenue, Falls Church, VA 22046') }}">Map</a> 68