Learning from Happy Lager
Transcript of Learning from Happy Lager
• Super powerful! Super flexible!
• But with all these options, things can get confusing quickly.
• “Channels or structures? Categories or tags? Entry types? Matrix?”
• Documentation and code examples are spread out.
TAGSFeatures:
https://buildwithcraft.com/features/categories-and-tags
TAGSTags Field:
http://buildwithcraft.com/docs/tags-fields
TAGScraft.tags:
http://buildwithcraft.com/docs/templating/craft.tags
TAGSTagModel:
http://buildwithcraft.com/docs/templating/tagmodel
TAGSElementCriteriaModel:
http://buildwithcraft.com/docs/templating/elementcriteriamodel
THINGS HAPPY LAGER DOESN’T COVER
• Categories
• Tags
• Locales/multilingual
• Users, user groups, registration, etc.
• {% cache %} • {% nav %}
WHAT’S IT GOOD FOR?• Client Demos
Entry drafts and versioning! Live previews!
• Content modeling examplessections, fields, entry types, assets, matrix fields, etc.
• Concrete template code examples{% set thingy = craft.entries.relatedTo(theNameofThatThingGoesHere) %}Where does that come from?
• Cool tricks & nifty ideas
Home
About Services Work News Search
ServicesEntries
WorkEntries
NewsEntries
single
single single
structure channel channel
single X X
INDEX SINGLES
• Services Index for a Structure
• Work Index for a Channel
• News... no need for a single.
Home
About Services Work News Search
ServicesEntries
WorkEntries
NewsEntries
single
single single
structure channel channel
single X X
INDEX SINGLES
• Control content for that page or section
• e.g. section title, header image, breadcrumb, etc.
• Control the route in the control panel
• /work could be change to /our-work later without worrying about updating any template file names or code.
ROUTES
Examples of 3 routing methods:
• Entry request: work, work/{slug}, about
• Template file paths: news... and about?
• Dynamic routes: search/results => search/_results
Home
About Services Work News Search
ServicesEntries
WorkEntries
NewsEntries
Locations(structure)
single
single single
structure channel channel
single X X
related
Sections
Field Name About Homepage Locations News: Article News: Link Services Services Index Work Work IndexFooter Content
(Globals)Site Assets
(Assets)
Address U
Article Body X X X X
Background Color U
Body X X X
Client Logos U
Contact Methods U
Contact Us Label U
Copyright Notice U
Email X X
Featured Image X X X X X
Featured Thumb U
Heading X X X X X
Hero Image U
Index Heading not used anywhere
Link URL U
Service Body U
Service Icon U
Services Performed U
Short Description X X X X X
Subheading X X
Testimonials U
Theme U
= Used in multiple sections = Unique field used in only one section
FIELDS
EXTENDING LAYOUTS
{% extends "_layouts/site" %} {% block main %} ... {% endblock %}
Did you know you can extend more than once?
Sections
Field Name About Homepage Locations News: Article News: Link Services Services Index Work Work IndexFooter Content
(Globals)Site Assets
(Assets)
Address U
Article Body X X X X
Background Color U
Body X X X
Client Logos U
Contact Methods U
Contact Us Label U
Copyright Notice U
Email X X
Featured Image X X X X X
Featured Thumb U
Heading X X X X X
Hero Image U
Index Heading not used anywhere
Link URL U
Service Body U
Service Icon U
Services Performed U
Short Description X X X X X
Subheading X X
Testimonials U
Theme U
= Used in multiple sections = Unique field used in only one section
FIELDS