Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Mixed up with basic file structure

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1897 Views
  • woodb2
    Avatar
    Community Member
    48 Posts

    Mixed up with basic file structure Link to this post

    I think I'm going to start my site over from scratch, but first I would like to know the proper way to go about it. Don't over think your answer, I'm not looking at something complex, just very basic setup.

    I built a very basic site using the blackcandy theme. I wanted to make some minor color changes so I copied the blackcandy theme to a new one (we'll call it newtheme). I make my changes to the css in newtheme and it looks like I'm wanting.

    I've tried doing the tutorials, but I'm getting lost at where I should be putting the files. Do they go in the tutorial directory (like in the tutorial) or the mysite directory or in with newtheme. I've had limited success doing the ArticlePage tutorial. It took several tries at putting the ArticlePage and ArticleHolder files in different directories to get the types to show up in the CMS (but they do now, but it doesn't work 100%) The Menu2 doesn't show like in the tutorial. In fact the left side menu doesn't work in any of the tutorial examples I've tried (News and Staff examples). The menu works perfect if I create a page with the default Page type.

    I'm willing to start from scratch (I haven't added content) if that's the easiest way to get a properly working site.

    I'm just not positive which directories I should be modifying/adding when working on the site.

    Any help would be appreciated. Thanks!

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Mixed up with basic file structure Link to this post

    Once you finish using the tutorial code then your custom PHP page types should go in mysite/code/ rather the tutorial/code/ . To tell SilverStripe to use the code from Mysite rather then the tutorial folder you need to

    * Copy tutorial/_config.php to mysite/_config.php
    * Open mysite/_config.php and edit the $project = "tutorial" to point to mysite - so $project = "mysite"

    * Run db/build?flush=1

    Or you can keep using the tutorial/ folder to store the code. Basically that $project var in the _config.php file tells SS where the code is.

    All your HTML, CSS and Images for your site should be in themes/newtheme/ as per blackcandy

  • Nadee
    Avatar
    Community Member
    12 Posts

    Re: Mixed up with basic file structure Link to this post

    I have a similar question.

    Both 'mysite' folder and the 'themes/<theme_name>' folder has the same folder structure with sub folders: code, css, images, javascript and templates. Why?

    If one should put the custom page types in 'mysite/code' folder, then what should go in 'themes/<theme_name>/code' folder?

    Any explanation is greatly appreciated.

    Thanks.

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Mixed up with basic file structure Link to this post

    this is a legacy issue that has not been fully resolved / explained - mysite/ folder does not need the css/ images/ and templates/ folders. You can put all your css / template folders in there and not use a theme if you want! normally I just have mysite/code/ , mysite/javascript and mysite/_config.php in the mysite folder.

    Unlike mysite where you can put code or templates etc the themes/yourtheme can only contain folders css/ images/ and templates/ as this is what consists of a 'theme'. No code. Just HTML and CSS and images.

    Some people put the Javascript files in the themes/yourtheme/javascript folder and that works fine!.

    Its a tad confusing at the moment but in conclusion my optimal layout is

    mysite /
    --- code/
    --- javascript/
    _config.php

    themes
    --- your theme name /
    ------ css/
    ------ images/
    ------ templates/
    ---------- Layout/
    ---------- Includes/

  • Nadee
    Avatar
    Community Member
    12 Posts

    Re: Mixed up with basic file structure Link to this post

    Thanks willr for the prompt reply. Now it makes sense.

    The tutorials doesn't clarify this and even the default SilverStripe release have the legacy folders in it.

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Mixed up with basic file structure Link to this post

    Yes those folders will be removed in the next release to help keep it clear and the tutorials are going to be updated.

    1897 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.