Posts to learn about Site Elements

10/24/2011

In my last blog I talked about why we had different content types.  In this blog I will go over creating a new content type from scratch.  This will allow you to create new items that you or others can add to your website. You will want to navigate to the Add New Content type page.  You can do this by clicking on 'Structure' in the black menu bar on your site, then clicking Content Types on the page that loads, and finally clicking on Add Content Type.

Once on the page you should see a page something like the screenshot to the left.  This time around I will be creating a new Note content type.  This will be used to create a Post-it like interface for a site.  So name the Content Type Note, in the description write something that will be easy for you to remember what this content type is for. In my case I will write "Create a new Note for the site."

Now with creating content types you have a lot of things to do, there are modules that let you add voting, there are modules that let you automatically Publish(Make Live) or Unpublish(Remove for public view) a piece of content and much more.  For now I will just go over the basics for adding a field and you can explore all of the different things you can do in later posts.

Under publishing options for this Content type i am going to set the default options to Published, and Create new revision.  Then Click the button that reads Save and Add Fields.

You will then be taken to a page that gives you the ability to add fields.  On this page we will be adding a single additional field for this content type, I will be adding a Importance field, meaning how important this note is.  

So we will want to enter in the label, machine name, field type, and widget for the new field.  I will briefly explan what each mean.  The Label is what users will see when they go to create a new note it is also what is displayed next to the value when someone views a note item on the site.  The Machine name or field_ entry is how your site knows what that field is and how to display it.  The Field type will be the type of field that your are creating, in our case we will be using a List (Text) field type.  The Form element or widget is how the options will be presented to a user creating a new note.   For our purposes we are going to use Check Boxes/Radio Buttons. Once you have these selected, click the Save button.  You will be taken to a page with a few more configuration options.

In our case it will ask for the Allowed Values list, meaning what values do we want users to be able to select for this field.  For my use i am entering Very Important, Normal, Not so important.  Enter one value per line and then click Save Field Settings.  You will then be taken to a page asking if you want to make the field Required, a help text field(tell users creating the item what this field means), as well as the Default value and other settings.  Once done with your settings click the Save Settings button.

You now have a completed content type that you can start adding to your site.  You can do many things with it and we will get into it in later developer blogs.

10/24/2011

Content Types or Types of nodes can be a hard concept to grasp at first, so dont beat yourself up over it if you get a headache when you think about them.  Sometimes I still do.  The Easiest way to think about a Content Type is to think of it as a type of item for your site.  For This blog I will compare a Page Content Type to a Product content type so that there is a real clear definition.

The Page
With the page content type you are creating a spot on your site that you want to represent an Actual page.  You generally only have a Title, Body, and url setting for a Page Content Type. So you would see a pretty simple form like the one shown in the image to the left.  Pages are flexible in that you can write anything you want in the body field, but they are strict in the sense that you cannot sell someone a Page through your website's store.

 

 

The Product

With the Product content type you get a lot more options in addition to the title and the body fields.  Im not going to go through all of the added fields here, but just wanted to show you that there is a SKU, Price, Shipping Details, and Image fields, along with a Catalog taxonomy.  Basically this adds functionality and adds additional details for this perticular type of node.

Why Do We Have so many Content Types anyways?
What content types allows is for you to create a form that is easy for anyone who comes along to fill out in order to create a new item on the site.  In the old way of building a website You would have to write more CSS and a whole new page of code to display this new item, but on Wembassy you dont need to do that.  You just need to create the Style / CSS for the first time and every time a new item of that type is added your website will be smart enough to make it have the same format of all the other items of that type.  It reduces coding time and makes adding new content or items to your site much simpler.