Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

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

changing templates not changing site...


Go to End
Reply


10 Posts   2525 Views

Avatar
JPG

Community Member, 53 Posts

15 January 2011 at 11:43pm

Edited: 16/01/2011 1:49am

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.

Avatar
swaiba

Forum Moderator, 1798 Posts

16 January 2011 at 1:55am

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.

Avatar
JPG

Community Member, 53 Posts

16 January 2011 at 2:03am

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 ;)

Avatar
Pigeon

Community Member, 243 Posts

16 January 2011 at 3:27am

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.

Avatar
DonR

Community Member, 3 Posts

27 January 2011 at 10:27am

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.

Avatar
Willr

Forum Moderator, 5513 Posts

27 January 2011 at 11:48am

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.

Avatar
kevinlieb

Community Member, 4 Posts

16 August 2011 at 9:21am

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.

Avatar
Ryan M.

Community Member, 309 Posts

17 August 2011 at 6:33pm

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

Go to Top