Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme »

Parse error: syntax error, unexpected T_STRING


  #1  
Old Jul 26, 2010, 10:36 PM
joe hark
 
168 posts · Feb 2009
I don't know where to put this but perhaps the moderator will accept my apology and put it where it will be available to help anyone else who encounters the subject error.

I was experimenting in the theme editor and screwed up. I had pasted some code into functions.php and it did not work. So I deleted it, being careful not to touch anything else.

After Update File, I got:

Quote:
Parse error: syntax error, unexpected T_STRING in /home/joebandh/public_html/wp-content/themes/atahualpa346/functions.php on line 665
So I looked at the file my favorite editor. Still saw no reason for the error message.

Next, I opened my backup copy of Atahualpa (POINT #1 of this tutorial - ALWAYS BACKUP BEFORE WORKING ON ANY CODE - it can never be said often enough - and there is nothing worse than screwing up and not having protected your arrogant, over-confident self) and did a Ctrl-c copy of the contents of my backup functions.php pasted Ctrl-v into the broken file.

Update File - and the problem had not gone away. The T_STRING error persisted. It was a genuine WTF moment.

I tried a very Hail Mary thing.

I opened the site in my FTP client and uploaded my local drive backup copy of functions.php to the server and OVERWROTE the entire damaged file.

That fixed the problem. No more T_STRING error.

Why did that work? I have no idea. I leave it to my betters, of whom there are many.

If anyone can add that explanation it would be welcome. But the essential point is, that overwriting did what copy/paste did not. I hope it helps someone in the future.
  #2  
Old Jul 27, 2010, 05:21 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
without access to the actual code, I can't tell you exactly what you did, but I can tell you what most likely was the cause.

First, I assume you were using the theme editor to do the first part. I suspect you left off or added an extra ';', '{' or '}' somewhere in the code. That is the reason I mostly see that error. A error in the syntax I typed. It could also be forgetting to add a '$' before a variable name or misspelling a name.

Second, there are several issues that could have happened. (1) You have a caching plugin active so even though you fixed it, you were seeing the cached copy of the page. (2). You opened up a fresh copy of 'function.php' IN WORD, and did a copy and paste. This could copy the Word formatting and cause all kinds of problems. Or (3) you did the copy and paste with a text editor, don't have a caching plugin active, but forgot to press UPDATE to apply the changes. I know this sounds crazy, but believe me I've forgotten to do it many a time - and I hit myself each time I forget.

That's my best guess based on the screw-ups I've made testing things.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Jul 27, 2010, 11:35 PM
joe hark
 
168 posts · Feb 2009
Thanks for your thoughts. It's a strange event.

We can eliminate the copy/paste from Word as a possible cause. I never do that. Whenever I want to launder some text I paste into Metapad, the plain text editor that is a good replacement for Notepad. But that was not involved in this event.

What I did was open functions.php in the theme editor and pasted two lines of code, directly after the final } and ahead of ?>.

When that code broke the site, I wnet back to the theme editor and deleted the two lines, taking great care not not delete anything else. Saving (Update) that returned the error.

So I went to my backup copy on my local drive, opened it in my default editor (Crimson Edit) and copy/pasted that over into the theme editor. That what did not work. And that surprised me. I went through the sequence maybe 3 or four times (I'm a bit of a obsessive compulsive), looking for what the pasted version might lack that exists in the backup.

My overwriting the backup copy to the server was an act of desperation. US football fans and Roman Catholics will understand that a "Hail Mary" pass is one the Quarterback throws as he is about to be overrun, with the prayerful hope that *somebody* - help me Mother of God - will catch it.

Aside from my great relief, I was amazed that it worked.

As for the forgetting to hit Update, that may have been it but I doubt it. I usually do not fail to do that, but because it is rote habit, I don't have a clear recollection of having done that - or not. In fact, now that I think on it, I *do* recall that I hit Update in each case because I recall my surprise that Update returned the error page. So we can definitely eliminate failure to Update as the issue.

It's still a mystery to me. Earlier today I saw the movie, "Inception" so I'm having some issues with recognizing what is real versus what is an induced dream.
  #4  
Old Jul 28, 2010, 04:06 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Any chance you have a cache pluginactive?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #5  
Old Jul 28, 2010, 05:54 AM
joe hark
 
168 posts · Feb 2009
what's a cache plugin? you mean a plugin that's installed but inactive? nope. all plugins are active.
  #6  
Old Jul 28, 2010, 06:23 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
There are several plugins like wp-cache' or 'WP Supercache' that will cache (store) pages so they don't have to be rebuilt for each user that visit the site. This can give a performance boost, but can cause confusion when making changes to the site. You make a change, go visit the site and get the cached (ie old) version of the page and nothing has changed.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #7  
Old Jul 28, 2010, 06:37 AM
joe hark
 
168 posts · Feb 2009
nope, not using a cache plugin
  #8  
Old Jul 28, 2010, 07:04 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
With out being able to see the code you had in there, there is no way to figure out what happened. You got it back working and that is what is important.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse error: syntax error, unexpected '<' in the functions.php file pingitt Atahualpa 3 Wordpress theme 6 Mar 12, 2013 04:52 AM
Parse error: syntax error, unexpected '<' in /home6/jonesber/public_html/wp-content/ jonesberries Atahualpa 3 Wordpress theme 2 Nov 30, 2009 04:33 AM
Parse error: syntax error, lost all center column content on all pages/posts Ladyartist Atahualpa 3 Wordpress theme 7 Oct 26, 2009 05:17 PM
[SOLVED] Home page won't load! Parse error, syntax error lhanft Atahualpa 3 Wordpress theme 4 Aug 30, 2009 02:44 PM
[SOLVED] Parse error: syntax error, unexpected ':', expecting ')' in /home/cwicsol/pu norwichkaren Page & Category Menu Bars 1 Jul 12, 2009 11:04 AM


All times are GMT -6. The time now is 11:56 PM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.