Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A shotgun introduction to Craft CMS

mccombs
August 11, 2014

A shotgun introduction to Craft CMS

A quick Craft introduction that I gave for the Web Fellowship group (http://webfellowship.org/)

mccombs

August 11, 2014
Tweet

More Decks by mccombs

Other Decks in Technology

Transcript

  1. What is Craft? Craft is a licensed content management system

    (CMS) from Pixel and Tonic. Craft is a content management system (CMS) that’s laser-focused on doing one thing really, really well: managing content. And since content comes in all shapes and sizes, we’ve built Craft to be as flexible as possible, without compromising on the ease of use for content authors. - buildwithcraft.com [ It will change your life ]
  2. Hello world Getting started with Craft Download Craft from buildwithcraft.com

    Unzip and move to your root folder Rename htaccess to .htaccess in /public Edit /craft/config/db to match your db settings Visit craft.dev/admin and follow the install process Read more about the install process at buildwithcraft.com/docs/installing
  3. look ma, no hands! No themes means ultimate control over

    look and feel. First Choice ER fcer.com Austin Fan Fest austinfanfest.com X Games: Band Battle xbands.xgamesaustin.com
  4. look ma, no hands! No themes means ultimate control over

    look and feel. Taecho Group taechogroup.com Craft Plus craftpl.us Mixes Martial Arts United mmartsunited.com
  5. Wordpress craft vs. Caveat: There is nothing wrong with using

    Wordpress Craft is your swiss army knife.
 The right tool for the every project Wordpress is the “as seen on tv” knife kit.
 Who needs 29 knives when just 1 will do?
  6. A house divided A look at the two halves of

    Craft / craft / public Core - Config - Plugins - Storage - Templates Index.php - Assets - Javascript - CSS - Images hidden for protection publicly accessible content Part 1
  7. templates and twig Craft uses a template engine called twig

    [ and it rocks ] Read more about twig at twig.sensiolabs.org/ PHP Twig <?php echo $var ?> {{ var }} <?php $arr = array(1, 2, 3, 4); foreach ($arr as &$value) { $value = $value * 2; } ?> {% for user in users %} {{ user.name }} {% else %} No users have been found. {% endfor %}
  8. craft templates A look at /templates/index.html {% extends "_layout" %}

    ! {% block content %} <h1>{{ entry.heading }}</h1> ! {{ entry.body }} ! <h2>Recent News</h2> <ul> {% for entry in craft.entries.section('news').limit(5).find() %} <li><a href="{{ entry.url }}">{{ entry.title }}</a></li> {% endfor %} </ul> {% endblock %}
  9. craft templates A look at /templates/_layout.html <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"

    lang="en-US"> <head> <body> {% block content %} <p>If you see me, you haven’t set your content block yet.</p> {% endblock %} </body> </html>
  10. Singles, channels and structures, oh my! Entries are categorized into

    3 different categories: Single pages, channels and structures. single Single pages are usually unique, one off pages like your homepage, about page and contact page channel Channels are recurring content pages like a blog, news feed, a team page etc. structure Structures are content pages that usually need to be given hierarchy and order like sub-nav pages. The ultimate goal is to customize content to match the site your building
  11. Section: Blog Folder structure {% extends "_layout" %} {% set

    title = "Blog" %} ! {% block content %} <h1>Blog</h1> ! {% for entry in craft.entries.section('blog').find() %} <article> <h3><a href="{{ entry.url }}">{{ entry.title }}</a></h3> <p>Posted on {{ entry.postDate.format('F d, Y') }}</p> {{ entry.body.getPage(1) }} <p><a href="{{ entry.url }}">Continue reading</a></p> </article> {% endfor %} {% endblock %} /blog/index.html
  12. Section: Blog Folder structure {% extends "_layout" %} ! {%

    block content %} <article> <h1>{{ entry.title }}</h1> <p>Posted on {{ entry.postDate.format('F d, Y') }}</p> {{ entry.body }} </article> {% endblock %} /blog/_entry.html
  13. defining fields for your entries Fields can be shared through

    every “section” or only used once - it’s your choice.
  14. 17 built in fields You can group fields to help

    with organization The ultimate goal is to customize content to match the site your building Assets | Categories | Checkboxes | Color | Date/Time | Dropdown Entries | Lightswitch | Matrix | Multi-select | Number | Plain Text
 Radio Buttons | Rich Text | Table | Tags | Users
  15. Working with Assets Assets (images and/or files) can be uploaded

    locally or sent to Rackspace or Amazon S3
  16. Working with plugins Plugins must be moved to the /plugin

    folder and installed by visiting Settings ~> Plugins
  17. learn more A look at the current craft ecosystem Straight

    up craft Craft plus stack exchange craftcms.stackexchange.com craftpl.us build with craft buildwithcraft.com straightupcraft.com
  18. BONUS Screen Craft Austin meetup tomorrow, 6pm at the Sputnik

    Office "Ginormo long form" A Craft Talk with Sam Hernandez 407B E 6th St, Austin, TX