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

Making changes to .ss in theme/templates + flush = layout disappears


Reply


4 Posts   1968 Views

Avatar
Mast4as

Community Member, 9 Posts

5 May 2011 at 8:32am

Edited: 08/05/2011 6:01am

Hi everyone

I am in a tricky situation. I don't know much about Silver Stripe and started digging into some files. I changed a couple of .ss in themes and played around with a php file in mysite. Things were fine but a few hours later when I reloaded the website the layout was all messed up.
I had to copy the silverstripe-cache over to get things back to normal. But today again the website layout went wrong. In the meantime I read on this forum that you needed to flush the cache when you were doing changes to the files in mysite. So I tried different things today:
- played with www.awebsite.com/admin/dev/build?flush=all
and flush=1 on individual pages and got a bunch of errors:

////

Notice: Undefined index: SSViewer in /data/13/1/1/160/1327812/user/1422783/htdocs/sapphire/core/ManifestBuilder.php on line 459

Warning: There are two files both containing the same class: '/data/13/1/1/160/1327812/user/1422783/htdocs/sapphire/core/#SSViewer.php' and ''. This might mean that the wrong code is being used. in/data/13/1/1/160/1327812/user/1422783/htdocs/sapphire/core/ManifestBuilder.php on line 461

Notice: Undefined index: SSViewer_FromString in /data/13/1/1/160/1327812/user/1422783/htdocs/sapphire/core/ManifestBuilder.php on line 459

Warning: There are two files both containing the same class: '/data/13/1/1/160/1327812/user/1422783/htdocs/sapphire/core/#SSViewer.php' and ''. This might mean that the wrong code is being used. in/data/13/1/1/160/1327812/user/1422783/htdocs/sapphire/core/ManifestBuilder.php on line 461

Notice: Undefined index: SSViewer_PartialParser in /data/13/1/1/160/1327812/user/1422783/htdocs/sapphire/core/ManifestBuilder.php on line 459

Warning: There are two files both containing the same class: '/data/13/1/1/160/1327812/user/1422783/htdocs/sapphire/core/#SSViewer.php' and ''. This might mean that the wrong code is being used. in/data/13/1/1/160/1327812/user/1422783/htdocs/sapphire/core/ManifestBuilder.php on line 461

Notice: Undefined index: SSViewer_Cached_PartialParser in /data/13/1/1/160/1327812/user/1422783/htdocs/sapphire/core/ManifestBuilder.php on line 459

Warning: There are two files both containing the same class: '/data/13/1/1/160/1327812/user/1422783/htdocs/sapphire/core/#SSViewer.php' and ''. This might mean that the wrong code is being used. in/data/13/1/1/160/1327812/user/1422783/htdocs/sapphire/core/ManifestBuilder.php on line 461

////

I removed the #SSView file and I tried the dev/build again and got the following message

The action 'dev' does not exist in class CMSMain

But even if I roll back to an older version that used to work (before I made changes to the ss file in template) and do a flush after that, the layout ends up messed up right way. Why isn't flush working in my case ?

This is so frustrating because I just don't know what I am doing, why I need to do that and why I get these error messages. And I really want to get my site back on track and be able to make small changes to the layout. Right now I rolled back to an old version of the website.

I hope I gave you guys enough info to help me out. I must say that at the end the layout is messed up even if I only change .ss files in the themes/MYTHEME/template directory. I even haven't changed the php files in the directory mysite.

If I could get some help from one of you would be GREATLY appreciated. Really it would help me to sleep better... ;-)

Thanks a lot for your your help -ma

Avatar
Mast4as

Community Member, 9 Posts

8 May 2011 at 6:03am

Can't anyone help me with this please ? Does anyone have an idea of what that could be ? I still have this problem and the website loses it layout once in a while. I have to copy the backup over. Somehow it seems also related to the .htaccess file. If I rename this file and rename it back, it causes the layout to disappear ? I would really appreciate some help on this.. thanks a lot

Avatar
martimiz

Forum Moderator, 1097 Posts

8 May 2011 at 6:47am

Edited: 08/05/2011 6:52am

Couple of things you need to know:

1. If you make changes to a template file, you need to refresh the SilverStripe cache, adding ?flush=1 to the url. If you don't do this, SilverStripe will keep using the old cached version. Best practice: do this after every (minor) template change, preferrably from a page that uses the template.

2. If you make changes to php class files, adding/removing/changing datbase fields, you need to /dev/build/?flush=1. This makes SilverStripe update the database to accommodate field changes.

3. Create a directory 'silverstripe-cache' in your website root and make it writable. SilverStripe will use it to store the cache, instead of in the server's default tmp dir. I guess you did this, but copying back the cache is only a temporary fix...

4. Most of the time, if you get a white screen after some change, there is an error in your code/template somewhere. Set SilverStripe into developer mode to display debug info. In your mysite/_config.php put: Director::set_environment_type("dev"); If this doesn't work, check logfiles if you have access.

Avatar
Mast4as

Community Member, 9 Posts

8 May 2011 at 9:40pm

Thank you so much. This is very clear and useful. I know it takes time to answer, so I really appreciate this. I will give it a try even though it seems that I have tried these steps already. But I will try again and try to understand the process better.
A thousand thanks -ma