Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Atahualpa 3 Wordpress theme (http://forum.bytesforall.com/forumdisplay.php?f=2)
-   -   Parse error: syntax error, unexpected T_STRING (http://forum.bytesforall.com/showthread.php?t=8544)

joe hark Jul 26, 2010 09:36 PM

Parse error: syntax error, unexpected T_STRING
 
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.

juggledad Jul 27, 2010 04:21 AM

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.

joe hark Jul 27, 2010 10:35 PM

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.

juggledad Jul 28, 2010 03:06 AM

Any chance you have a cache pluginactive?

joe hark Jul 28, 2010 04:54 AM

what's a cache plugin? you mean a plugin that's installed but inactive? nope. all plugins are active.

juggledad Jul 28, 2010 05:23 AM

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.

joe hark Jul 28, 2010 05:37 AM

nope, not using a cache plugin

juggledad Jul 28, 2010 06:04 AM

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.


All times are GMT -6. The time now is 12:15 PM.

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