Jump to:

22977 Posts in 11806 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » changing templates not changing site...

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1 2
Go to End
Author Topic: 2226 Views
  • JPG
    Avatar
    Community Member
    53 Posts

    changing templates not changing site... Link to this post

    Am sure this is a basic problem that is very easy to understand and get working but I am in stupid mode. Basically - I am changing elements of my templates but they are not changing in my front end pages? Can anyone tell me why?

    Many thanks

    nb: have cleared cache as well as history etc of browser and rebuilt db but nothing changes - even if i check it in a browser that has not seen the site yet it seems to be pulling the content info from somewhere else

    BTW - the info that i am changing is static footer info.

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: changing templates not changing site... Link to this post

    Just to clarify how you clear the cache... I create a silverstripe-cache folder in the webroot and I delete the entire contents... this is my way of clearing the cache because a dev/build?flush=all doesn't clear templates with nested includes.

  • JPG
    Avatar
    Community Member
    53 Posts

    Re: changing templates not changing site... Link to this post

    Thanks swaiba
    I kind of fixed it - as unexplained as it appears - i deleted the <% include Footer %> element from my page.ss, saved and refreshed the page in the browser then popped it back in and low and behold it re-appeared with my changes there. (FYI) I cleared the cache via the default "clear recent history" (i am testing in FF). Thanks for the advice - will try your method on my next change if the problem persists

    PS: Am still wrestling with the MAMP problem we discussed a few days ago - thanks for your help there too ;)

  • Pigeon
    Avatar
    Community Member
    243 Posts

    Re: changing templates not changing site... Link to this post

    Whenever you make changes to your templates (especially includes) you should append ?flush to the url of the page you made changes to.

    This is because SS caches the templates as raw PHP and the ?flush flag tells SS to re-parse the templates.

  • DonR
    Avatar
    Community Member
    3 Posts

    Re: changing templates not changing site... Link to this post

    Changes to my Includes/Header.ss weren't working and doing the above still didn't clear the cache. This worked:

    1 - copying to my desktop then removing the entire Includes folder from the server
    2 - running /dev/build?flush=all
    3 - manually removing all the files in the silverstripe-cache folder
    4 - visiting the home page of the site with ?flush=1
    5 - copying from the desktop to the server the entire Includes folder
    6 - running /dev/build?flush=all
    7 - manually removing all the files in the silverstripe-cache folder
    8 - visiting the home page of the site with ?flush=1

    I hadn't made changes to the SS files for several months, and it was a surprise to run into this issue where my simple change didn't get picked up. However, before I made my change to the Header.ss, I did a "duplicate" of the templates folder with my ftp client. Right after doing that my ftp client could not do a chmod to the templates folder, displaying an infrequent error the folder could not be found. Perhaps my ftp client changed a permission or something like that to mess things up.

    SS is great. After hundreds of hours with Drupal and Joomla, SS is sane and has a great community. Thank you.

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: changing templates not changing site... Link to this post

    Just to note - you shouldn't need to do a full /dev/build?flush=all just for template changes as that is designed to rebuild your database. Simply doing a ?flush=all should work fine.

  • kevinlieb
    Avatar
    Community Member
    4 Posts

    Re: changing templates not changing site... Link to this post

    This was driving me mad but the ?flush at the end of the url did the trick. Like:
    http://localhost/?flush
    in the case of the home page.

    Dev mode should mean dev mode, no cache, not anywhere not ever.

  • Ryan M.
    Avatar
    Community Member
    309 Posts

    Re: changing templates not changing site... Link to this post

    if (Director::isDev()) {
    SSViewer::flush_template_cache();
    }

    2226 Views
Page: 1 2
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.