syntax error has blocked any further editing
Permalink
There is a typo in one of my PHP Code Blocks inside the Footer Navigation. Now when I click on Home - Visit from the Sitemap, or any other page for that matter, I get "An unexpected error occurred. syntax error, unexpected end of file" I know what the problem is and how to fix it, but I AM BLOCKED FROM VIEWING THE PAGES BY THIS ERROR! This is not a caching error. I cleared my cache and restarted my machine and am still getting the error. Note that this only happens when logged in. If Joe public hits the site (troop4.s2rtechnologies.com) everything is fine. This only happens after I log in and attempt further editing. SO, is there some other way I can just delete that block from the global footer area?
I would indeed like to delete Footer Navigation from Global Areas, but there does not seem to be an option to do this.
you could also delete the block that the code is in from the dashboard > block types
I think one of those footer areas will have your culprit in it. Have a look at all of them.
I actually know exactly what the culprit is and where it is (I ended a php if statement with a '{' instead of a '}' - oops). The problem is that now I cannot get back to the page or any page in Edit mode - I keep getting this syntax error message. I am blocked from correcting anything or deleting anything, unless there is some other way to edit or delete.
edit the theme file and remover the area that has the code. better yet just rename it.
so if its
make it
so if its
$a = new Area('Footer');
make it
$a = new Area('New Footer');
Forgive me, but I am logged into the site remotely and am not at the actual server - I have no option to open the file through a file browser or get to the file with a command line opened on the server. I am stuck with just what is on the Dashboard. Sure, I can see the error log and yes that tells me the path to the file. But I cannot actually get to the file through anything available on the dashboard. Is there some other way on the Dashboard to access and edit theme files? Thank you for your assistance.
can you ftp to the server? cpanel access?
what block did you use to add the code to your page? the html block? or something else?
what block did you use to add the code to your page? the html block? or something else?
The real issue is not how to fix the syntax error. The real issue is that the Dashboard does not provide sufficient access to server files if a developer is working off-site. As someone mentioned earlier, the answer is to have the host server admin give me access to the server, not just the site. Thank you for your help.
If the front end of the site is inaccessible. You can go directly to the dashboard, /sitename.com/index.php/dashboard/ , enter the sitemap, and revert the page version from there.
Direct php code blocks are 'black/bleeding edge' in the marketplace for a very good reason. They make it very easy for a single typo like you have made to break a site. Any developer that knows enough to use a php code block should also know enough not to want to use a php code block ;-)
The php code blocks in the marketplace have documentation on how to delete a faulty block's content or disable php execution within the block, so providing another way to recover from code mistakes.
Direct php code blocks are 'black/bleeding edge' in the marketplace for a very good reason. They make it very easy for a single typo like you have made to break a site. Any developer that knows enough to use a php code block should also know enough not to want to use a php code block ;-)
The php code blocks in the marketplace have documentation on how to delete a faulty block's content or disable php execution within the block, so providing another way to recover from code mistakes.
" Any developer that knows enough to use a php code block should also know enough not to want to use a php code block ;-)"
How else am I supposed to make small alterations to the site for situations where the Dashboard doesn't provide a highly curated way to go about it? For example, on my main page I need certain links to not appear in the header nav bar until after the user is logged in. All the documentation I read says "do xyz with the php." Terrific. I don't have access to the server files (long story - has to do with the fact that this is a volunteer project and the other volunteer hosting the site does want to open any ports on his server). So how else to I make little tweaks to the PHP?? I'm using Elemental and there is no Customize button. I can't eject all of my themes and go back to Plain Yogurt which I have read does have a Customize button because once I added the Elemental theme apparently it is a core theme and I am stuck with it. There are no other free themes that have a Customize button (this is a volunteer project - no money). Plenty of the blocks that Elemental and the other themes ship with let me change HTML but not of them recognize processor code - any php you add gets treated like a syntax error. SO the dashboard gives you no access to change php, all of the documentation assumes you have access to change PHP, and then when I think I have found a way to tweak the php via an add on, it turns out I'm stupid for trying.
How else am I supposed to make small alterations to the site for situations where the Dashboard doesn't provide a highly curated way to go about it? For example, on my main page I need certain links to not appear in the header nav bar until after the user is logged in. All the documentation I read says "do xyz with the php." Terrific. I don't have access to the server files (long story - has to do with the fact that this is a volunteer project and the other volunteer hosting the site does want to open any ports on his server). So how else to I make little tweaks to the PHP?? I'm using Elemental and there is no Customize button. I can't eject all of my themes and go back to Plain Yogurt which I have read does have a Customize button because once I added the Elemental theme apparently it is a core theme and I am stuck with it. There are no other free themes that have a Customize button (this is a volunteer project - no money). Plenty of the blocks that Elemental and the other themes ship with let me change HTML but not of them recognize processor code - any php you add gets treated like a syntax error. SO the dashboard gives you no access to change php, all of the documentation assumes you have access to change PHP, and then when I think I have found a way to tweak the php via an add on, it turns out I'm stupid for trying.
You're not stupid for trying, and no-one was suggesting that.
It's just that if you are wanting to make deeper changes to the way concrete5 works and displays, you _have_ to be able to adjust code, preferably through creating override files. And it's just not manageable to try to use a PHP block to do that, you need access to the files. You also just won't be able to do most things, that block is really only for very limited tasks I'd say.
With your task to make only certain links appear in the header bar, that sounds like you should be able to just use permissions on the pages to control their visibility - perhaps explore that first before considering a programatic approach.
Going back a bit though, the problem here isn't that concrete5 doesn't allow you to edit code (it shouldn't), the problem is simply that you haven't got appropriate access to the server.
If your 'host' isn't allowing you access to edit files, but you have been given tasks to complete where that access is needed, you shouldn't be trying to work around that limitation - instead you should be either:
- going back to the 'host' and telling them that you need access again, perhaps offer something like an IP restriction or something else to make them feel more comfortable.
- or, going back and telling them to do _your_ tasks instead, since it's their restrictions
- or, going back to the organisation and politely explaining the issue, that you can't complete all tasks on the site due to this restriction
- or, asking for the site to be moved somewhere else where you can make edits
It's unreasonable for you to be put in a position where you can't get access to the files, but have been asked to make edits that go beyond content management tasks. The responsibility of hosting isn't _just_ running a webserver, it's all the other stuff like backups, monitoring _and_ providing appropriate access for development and maintenance.
I've dealt a few times with people who host community sites for free, but don't give you appropriate ways to manage things properly - we thank them for their support and then remove them from the equation.
Just because you're a volunteer doesn't mean you should have to work with unreasonable restrictions!
It's just that if you are wanting to make deeper changes to the way concrete5 works and displays, you _have_ to be able to adjust code, preferably through creating override files. And it's just not manageable to try to use a PHP block to do that, you need access to the files. You also just won't be able to do most things, that block is really only for very limited tasks I'd say.
With your task to make only certain links appear in the header bar, that sounds like you should be able to just use permissions on the pages to control their visibility - perhaps explore that first before considering a programatic approach.
Going back a bit though, the problem here isn't that concrete5 doesn't allow you to edit code (it shouldn't), the problem is simply that you haven't got appropriate access to the server.
If your 'host' isn't allowing you access to edit files, but you have been given tasks to complete where that access is needed, you shouldn't be trying to work around that limitation - instead you should be either:
- going back to the 'host' and telling them that you need access again, perhaps offer something like an IP restriction or something else to make them feel more comfortable.
- or, going back and telling them to do _your_ tasks instead, since it's their restrictions
- or, going back to the organisation and politely explaining the issue, that you can't complete all tasks on the site due to this restriction
- or, asking for the site to be moved somewhere else where you can make edits
It's unreasonable for you to be put in a position where you can't get access to the files, but have been asked to make edits that go beyond content management tasks. The responsibility of hosting isn't _just_ running a webserver, it's all the other stuff like backups, monitoring _and_ providing appropriate access for development and maintenance.
I've dealt a few times with people who host community sites for free, but don't give you appropriate ways to manage things properly - we thank them for their support and then remove them from the equation.
Just because you're a volunteer doesn't mean you should have to work with unreasonable restrictions!
Thanks to everyone who took the time to assist with this. I actually just found something that is kind of the answer but not a good one. Rolling back the Version does not work, not for a goofed up PHP Code Block. You have to completely get rid of the offending code block. To do this go to Dashboard - Extend Concrete%. There you will see the 'HTML+PHP Code Block' add on and from there you can uninstall it. A warning pops up that if you do this it will delete everything in the db created by this block. Unfortunately, this is the only option. In my case I had only a few changes that got wiped out. This would have been a nightmare if I had gone ahead and used the PHP code block in multiple places. Gonna have to have a word with the fellow hosting the site.
you can rewind the version to the previous in the dashboard sitemap.