ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

First time using EE

April 19, 2012 5:23pm

Subscribe [2]
  • #1 / Apr 19, 2012 5:23pm

    giovannidc

    11 posts

    Hi all,

    I thought I’d give EE a try but I’m finding the user guide a little vague when setting up your first site so I just have a few questions regarding templating and how I would approach this using EE. Are there any recommended tutorials out there, preferably video?

    Anyway, let me ask the kindergarten stuff:

    I want to create a template for a website, the website has the following:
    -home page: This displays a few featured and latest items
    -catalogue page: Displays a list of items according to category
    -item page: Will display detailed information regarding item

    Now all three these page types have the same header, menu and footer, Its just the middle part that changes. I want to know how do I bring this all together:
    -Where do I put my css and js files, my images like the logo, button images etc and how do I call them?
    -And how would I change things in the header like the page title or which menu item is selected according to what content I have called?

    Do i use snippets or embedded templates for this?

    Thanks in advance

  • #2 / Apr 19, 2012 6:11pm

    zizther

    228 posts

    Hi giovannidc.

    Glad your getting into EE.

    What you want to do is all very easy, Once you understand it you will fly through it.

    Mike at Train-ee has alot of good stuff http://train-ee.com/
    His book is meant to be good too.

    His tutorials are super. They are for EE1, but not much has changed, so you should be able to learn a lot. Just change ‘weblog’ to ‘channel’ and if he uses dynamic=“off” you should use dynamic=“no”

    A breakdown of what you are doing. The best thing is to create the templates outside of EE and load them to a directory using FTP.

    What you would usually have is a strcutre like this:

    global.group
      .footer.html
      .header.html
      index.html
      .menu.html

    home.group
      index.html

    catalogue.group
      index.html

    item.group
      index.html


    * In EE you can change where you will have the templates stored, by default it is in system/expressionengine/templates.

    * Where ever you decide to put your templates you have to put a directory called default_site then place your templates groups in there, this direcotry has to be called default_site.

    * Each group directory has to have .group after it.

    * All groups have to have an index.html, even if you are not going to use it. It is a good idea to place a message in these or do a redirect.

    * In EE go to the Template Manager, there you can select what group is the main group. you will want to do this for ‘home’

    * Note when creating templates externally you make the .html and place all languages in them, such as PHP.

    * In global.group, the . in front of the files does not mean anything, i use it as an identifier to know it is an embed template.

    * In your home, catalogue and item index templates you can embed the header, menu and footer. You can use snippets, these would be used for small static content such as email address, email address, etc.

    * I keep my CSS and JS out of EE as it saves EE having to process it. you can put this anywhere on the server, i am sure most put it in a directory in the root. You can link to it by using {path=""} this will create a URL using the base URL, for example {path="assets/css/styles.css"} will create http://domain.com/assets/css/styles.css
    Obviously you can use relative links in CSS still. More info here

    * To call entries from a channel you can use this

    * To control the menu you can set the active menu item to have a class or id based off the segments.
    - segment_1 is the segment after the index.php or after the domain extention if you have removed the index.php
    - segment_2 is the next part of the url after the /
    - segment_3 is after segment to, and so on…

    You can only control up to 9 segments, not that you will need that many. More info here

    So to control the nav do something like this:

    <a href="http://{site_url}%22class=%22active" title="" class="active">Home</a>
        <a href="http://{site_url}%22class=%22active" title="" class="active">Catalogue</a>
        <a href="http://{site_url}%22class=%22active" title="" class="active">Item</a>

    * To control the title you can use add-ons to help but there is a really easy way.
    In your .header.html template in the title tag you can put something like

    <title>Site name {embed:page_title}</title>

    Then when you embed the header in your other templates you can call the variable in header and give it a value:

    {embed="global/.header.html" page_title="| Home"}

    You can do the same thing for the keywords and description.

    * Further information on categories can be found here and here.


    Hope that is all clear. Tutorials are the best and Mike offers some really good ones!
    Any more questions the community is here to help.

     

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases