joe_g Posted June 15, 2021 Share Posted June 15, 2021 Hi all, I just had something scary happening (on my dev server luckily). I was working on an old project that has comparatively lots of data. ~1500 "event" pages, the event template has 30-40 fields. And I added another one, a repeater for a gallery. Then suddenly, while working on some unrelated front end stuff the 'event' template had been rename to '1', and everything stopped working obviously. When looking at the '1' template it had all fields listed as strings, and not the usual draggable list of fields. I tried renaming it to 'event' again, but I got the prompt that 'event' was already taken. I then renamed it to 'eventa' - that worked, and could then rename it again to 'event' Now things are back to normal, but I wonder - what happened? It can't be a keyboard slip since renaming a template needs a confirmation.......??? thanks for any insights in this mysterious matter, j Link to comment Share on other sites More sharing options...
joe_g Posted June 15, 2021 Author Share Posted June 15, 2021 After some introspection I think I know what might have happened, I probably made the error to '=' instead of '==": if($page->template->name='xx') { Hope this helps someone else ? 1 Link to comment Share on other sites More sharing options...
netcarver Posted June 15, 2021 Share Posted June 15, 2021 If you can build enough discipline in the way you write conditionals, you can avoid this by always putting the constant part first: if ('xx' == $page->template->name) { So if you accidentally miss an equals sign and do an assignment, you get an error from the runtime as you are trying to assign to a constant string literal. I've tried to build this habit over the years and sometimes remember to do this - but I'm not there yet. 4 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now