2

I'm really struggling with understanding how Craft works at the moment. I've been started mid-way on a particular project and I just can't get my head around how Craft works.

Their documentation seems to assume some knowledge I just don't have and combined with the intermediate-to-expert level of Craft-use in the project I'm on, I just can't figure it out.

Right now I'm failing at even the simplest things. I see fields as 'variables' of an entry, which are then sectioned? I'm doing things that work one particular way:

{% set entries = craft.entries.slug('xyz') %} {{entries.navigationCaptionTitle}}

..but not another:

{% for block in entries %} {{ block.navigationCaptionTitle }} {% endfor %}

..and I think it's down to my basic understanding of how Sections, Entries and Fields work, how Craft manages them and their basic terminology. I'm definitely a visual learner so anything remotely graphical will help.

I don't have any CMS background, largely just working on html, css and js.

5

Best is to create fresh Craft instalation and experiment, learn basics. I did the same thing when I was assigned to a large drupal project.

Here is a resource list on Craft:

"..and I think it's down to my basic understanding of how Sections, Entries and Fields work"

It's quite simple really :) You attach fields to section - this defines a "template" for your entry/entries.

Single type section has one entry, Channel & Structure have multiple entries. Also you can create few entry types for Channel & structure (https://straightupcraft.com/articles/how-do-i-output-an-assets-field-inside-a-matrix-field-inside-an-entry-type).


STRUCTURE SECTION EXAMPLE

  1. Create fields enter image description here

  2. Create section enter image description here

  3. Create Entry types (Click Edit Entry types) enter image description here Drag&Drop fields enter image description here enter image description here

  4. Create new Entries enter image description here Note: Entry type changes enter image description here enter image description here

  5. Create entry template file (see step 2 for file location). File located under (installation folder)/craft/templates/example/_entry.twig

enter image description here

  1. Result

enter image description here enter image description here


You can also pull those two entries from any twig file like this (Details):

{% for entry in craft.entries.section('example') %}
    <a href="{{ entry.url }}">{{entry.title}}</a><br>
{% endfor %}

OR just first one

{% set firstExample = craft.entries.section('example').first() %}
<a href="{{ firstExample.url }}">{{firstExample.title}}</a><br>

See also this

  • Your resources are my best bet, and as you said, making a new Craft and following through the whole thing will be best. – vSanjo Nov 8 '16 at 0:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.