Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Itchigotim on May 09, 2013, 03:46:39 AM

Title: Template parse error
Post by: Itchigotim on May 09, 2013, 03:46:39 AM
This just started appearing on my site. Not sure why. No recent changes I'm aware of to the site. We also get it with the default template. Does anyone have any ideas? (By the way, I'm a little green when it comes to php, so please keep it simple).
Title: Re: Template parse error
Post by: Colin on May 09, 2013, 04:15:44 AM
Howdy,

That is pretty frustrating, isn't it :). Did you happen to install any mods? What theme are you using?
Title: Re: Template parse error
Post by: Shambles on May 09, 2013, 04:17:56 AM
Strange that nothing has changed as far as you're aware. I'm guessing that something has indeed changed, as borne out by that error message.

Can you attach a copy of Profile.template.php to your next post here?

Title: Re: Template parse error
Post by: Itchigotim on May 09, 2013, 10:43:12 AM
I'm a little green here, how do I do that? I'm guessing notepad isn't what you're looking for.

I haven't added any recent packages, say in the last month. It's possible this has been going on for a while, but I only noticed this error in the last week or two, when I click on a member's profile. My other admin (more learned than me in this area) hasn't done anything either, but he said he's noticed some weird going's on in the admin area (not specific as to what it is).
Title: Re: Template parse error
Post by: kat on May 09, 2013, 10:54:27 AM
Download the file (Profile.template.php). Then, attach it to your next post. :)
Title: Re: Template parse error
Post by: Itchigotim on May 09, 2013, 11:03:43 AM
Do you mean the my sql backup? That's all I can find.
Title: Re: Template parse error
Post by: Kindred on May 09, 2013, 11:08:46 AM
egads...

attachment removed.
No... not the SQL.

from your SITE control panel (not smf...) you should have a file manager - or you can use FTP.
you can then get the file K@ mentions
Title: Re: Template parse error
Post by: Itchigotim on May 09, 2013, 11:19:06 AM
Sorry, some things I'm ok at, this is not one... It took some looking in ftp, but I think I have it.
Title: Re: Template parse error
Post by: Kindred on May 09, 2013, 11:25:24 AM
the egads was not a comment on you, but rather on including the SQL which contains the personal information on all your users, yoru site and everything to do with your forum... :)
Title: Re: Template parse error
Post by: kat on May 09, 2013, 11:37:34 AM
Can you look at the ol' error-logs, Itchi, to see if there's anything relevant, there?
Title: Re: Template parse error
Post by: Shambles on May 09, 2013, 11:41:43 AM
I checked the file and also pushed it through two online syntax-checkers, without issue.

I get a slightly different templating error when I visit a profile on your forum, suggesting a probable cache corruption?

Might be worth clearing your forum cache files.
Title: Re: Template parse error
Post by: Itchigotim on May 09, 2013, 11:43:03 AM
It's ok, it's not the first time I've heard it. ;D But I was wondering if it did have such info in it. Thank you! Now I know. You have to understand, I'm completely self taught. I taught myself windows  a little less than 5 years ago, I didn't even know how to type.  I've designed a dozen games or so, and am teaching myself html, and css by looking at existing codes and following the patterns. Most of you remember the old computers, I don't know a time before xp. ;)
Title: Re: Template parse error
Post by: Itchigotim on May 09, 2013, 11:46:17 AM
What am I looking for in there? Right now what I can see is the errors started about 4-9-13. Critical errors, I take it?
Title: Re: Template parse error
Post by: Kindred on May 09, 2013, 11:48:38 AM
no worries...    I'm a grumpy bugger, but I do appreciate people who are willing to try, willing the learn and, most importantly, willing to listen when folks with knowledge in a specific area speak up.

You remind me of the way that I learned Pascal and C.
(got myself a BBS package back in the 80s and worked through 50,000 lines of spaghetti code)


Now.. back to your problem.  Would you be willing to give one of the support folks here admin access to your site?
Title: Re: Template parse error
Post by: Itchigotim on May 09, 2013, 11:55:51 AM
I could do that. What do I need to backup first? The mysql, or more? Oh, and I do believe the cache was already cleared by my other admin.
Title: Re: Template parse error
Post by: Kindred on May 09, 2013, 11:59:08 AM
always take two backups.
1- the database (and you should use your site control panel or phpmyadmin to do this - the backup in SMF has issues with some servers and may fail, especially as the forum gets bigger)

2- the files (either by taking a download via ftp of all files and subdirectories in the forum directory or by using the backup function in your site's control panel)
Title: Re: Template parse error
Post by: Itchigotim on May 09, 2013, 12:10:15 PM
Doing it now. The database file I'm guessing is the my sql I got earlier. For the ftp, I just highlighted everything and dragged it into a folder to copy it as is.
Title: Re: Template parse error
Post by: Colin on May 09, 2013, 12:21:50 PM
Correct.
Title: Re: Template parse error
Post by: MrPhil on May 09, 2013, 12:38:02 PM
Quote from: Itchigotim on May 09, 2013, 12:10:15 PM
The database file I'm guessing is the my sql I got earlier.
You mean ".sql" file? That would be the correct one, provided it includes the IF-EXIST-DROP-TABLE and CREATE-TABLE commands for each table. That's a "backup" file that includes information to create the tables anew. You make it in phpMyAdmin via "Export", or maybe some equivalent in your hosting control panel. You don't want to back up the raw MySQL data files (*.myd, *.myi, etc.), as you won't be able to restore them onto another system.

Quote from: Itchigotim on May 09, 2013, 11:43:03 AM
Most of you remember the old computers, I don't know a time before xp. ;)
Old Geezer Alert! I started on a timeshared PDP-8 ("8K BASIC") on a TeleType with blazing 134 baud dialup. My first college course in programming was on an IBM 360 with FORTRAN IV on punch cards. Scared you enough yet?
Title: Re: Template parse error
Post by: kat on May 09, 2013, 12:42:32 PM
Bloody kid. :P ;)
Title: Re: Template parse error
Post by: Itchigotim on May 09, 2013, 01:06:44 PM
lol. I could've probably handled that. I used to work on video games/pinballs/jukeboxes. But I didn't get into computers by choice. I thought they were taking over our lives and we wouldn't be able to do anything for ourselves. Glad to see I was wrong.... :D

Who would be interested in working on this? I should say we are a small donation run site, so I can't offer more than my thanks, well and some games for your laptop that we have up for download.
Title: Re: Template parse error
Post by: kat on May 09, 2013, 02:13:50 PM
If you want that as a background, it's not terribly difficult to do, if I remember rightly.

Have a look at this:

http://playing.twaddlehosting.co.uk/index.php?theme=14

See how the background stays static, when you scroll up and down?
Title: Re: Template parse error
Post by: Chalky on May 09, 2013, 02:18:06 PM
You can't do much scrolling when all you see is the login page  ;)
Title: Re: Template parse error
Post by: kat on May 09, 2013, 03:04:05 PM
Ah. I thought guests could see the portal. :P
Title: Re: Template parse error
Post by: Chalky on May 09, 2013, 03:05:26 PM
No, all we guests can see is a quality artistic image and the login box ;)
Title: Re: Template parse error
Post by: kat on May 09, 2013, 03:09:14 PM
Can they see some parts, now?
Title: Re: Template parse error
Post by: Chalky on May 09, 2013, 03:11:32 PM
Quote from: K@ on May 09, 2013, 03:09:14 PM
Can they see some parts, now?

Nope...
Title: Re: Template parse error
Post by: kat on May 09, 2013, 03:15:57 PM
Poo. Well, in a nutshell, the background stays put and everything else scrolls up and down, over it.
Title: Re: Template parse error
Post by: Arantor on May 09, 2013, 03:17:01 PM
background-attachment: fixed is a wonderful thing
Title: Re: Template parse error
Post by: kat on May 09, 2013, 03:38:02 PM
So are boobies.

Sorry, I got distracted... I just read Chalky's "Meet the weirdos" topic. ;)
Title: Re: Template parse error
Post by: Itchigotim on May 09, 2013, 03:40:30 PM
I think a background would make my place harder to read. But I am open to all sorts of stuff.
Title: Re: Template parse error
Post by: kat on May 09, 2013, 03:55:33 PM
When you posted the pic, I kinda assumed it was for a background.

Thing is, if you make such images a full background, the colours will swamp the text.

If it wasn't for a background, where do you want it,?
Title: Re: Template parse error
Post by: Itchigotim on May 09, 2013, 04:44:55 PM
I don't want it, I was just showing what you can download.
Title: Re: Template parse error
Post by: kat on May 09, 2013, 04:53:19 PM
Oh, right! DOH!@ME! :)

I quite enjoyed Pinball Fantasies, on the Amiga. I liked the real life Terminator one, too. Pity I never found that table for a computer... :(
Title: Re: Template parse error
Post by: Itchigotim on May 09, 2013, 07:00:55 PM
Not a problem. You mean this one? With the software we use (freeware) anything done in the last, well, ever, can be re-created. We have what we call "desktop" versions (played on a laptop 4:3 or widescreen) or full screen. Fullscreen is a hi def tv turned sideways, specifically for pinball. The only thing you need is a good computer with a decent graphics card.

I reread everything and found I missed answering Colin's question. We are using Dark Classic as a theme.

I work the next 4 days, so I'll only be around a limited time during then (fri-mon), usually in the evenings 6-8pm cst. If anyone is interested in working on helping me with this, please let me know.
Title: Re: Template parse error
Post by: kat on May 10, 2013, 07:17:20 AM
I think your site looks pretty groovy, as it is, myself. No point in making things look too cluttered, ay? ;)

Nope. The Terminator one that I remember had a kinda gun thing, on the right. When the ball went in it, it swivelled and you had to shoot the ball from the gun thing, at targets. Mid-late eighties?
Title: Re: Template parse error
Post by: Itchigotim on May 11, 2013, 04:30:28 AM
Thank you. :)

I'm guessing late 80's to early 90's myself, but that's about the time I left the business.

I don't think we have a lot planned in terms of appearance, maybe adding some packages, though. But not until we get this fixed, no need to make this worse. :-[
Title: Re: Template parse error
Post by: Itchigotim on May 11, 2013, 10:04:59 PM
What else can I look at/for about fixing this? I'm fully backed up. :)
No recent packages have been installed in about a month, but I don't think this problem goes quite that far back. I can't get into the package manager to see what's there, because of this error.
Title: Re: Template parse error
Post by: Kindred on May 11, 2013, 10:27:14 PM
Sorry. Pm me the URL, and account login info and il will try to take a look at it tomorrow or Monday.
Title: Re: Template parse error
Post by: Itchigotim on May 12, 2013, 04:44:04 AM
Thank you, PM sent, but I don't see a copy in my sent folder. It says it went through though.
Title: Re: Template parse error
Post by: Itchigotim on May 14, 2013, 03:58:13 AM
Just curious if you had a chance to look, or what you found. :)
Title: Re: Template parse error
Post by: Itchigotim on May 14, 2013, 05:49:23 PM
I noticed something, don't know if it's the cause. In my error logs it shows a lot of this (error.jpg)

Then I noticed 2 subs.php

(I downloaded the sources/subs folder to find this).

Is there a connection here, having 2 files the same name, or is this where the error lies?
Title: Re: Template parse error
Post by: Arantor on May 14, 2013, 06:18:54 PM
QuoteIs there a connection here, having 2 files the same name, or is this where the error lies?

They don't have the same name. One is Subs.php the other is Subs.php~ and the second is a backup of your file from the last mod you added which modified it.

So you have a rogue mod that does something it shouldn't...
Title: Re: Template parse error
Post by: Kindred on May 14, 2013, 07:53:21 PM
sorry... work has been busy lately. I have not had a chance to get to your site yet.  I'll try to do so by tomorrow evening.
Title: Re: Template parse error
Post by: Itchigotim on May 14, 2013, 10:24:56 PM
Np Kindred, thanks.

Arantor, I do have a mod that was using "compatability mode" for a previous version. But this was done some time ago, before this.
Title: Re: Template parse error
Post by: Arantor on May 14, 2013, 10:37:33 PM
Compatibility mode is no such thing. All it means is you told the package manager to use a specific set of instructions.

It is down to a rogue mod, verse is pretty much irrelevant. So what mods do you have?
Title: Re: Template parse error
Post by: Itchigotim on May 15, 2013, 02:42:36 AM
We think we may have this down to some missing files. You're still welcome to take a look, but that's our best guess (my tech guy).
Title: Re: Template parse error
Post by: Arantor on May 15, 2013, 08:20:15 AM
No, it's not down to some missing files. It's an error in the code caused by one or more of the mods you have. Your 'tech guy', if he's competent, should have been able to understand the difference between an undefined index and something more serious.
Title: Re: Template parse error
Post by: Kindred on May 15, 2013, 09:39:36 AM
Arantor,

I had intended to look at this on Sunday, but real life has gotten the better of me til now. I plan to look at his system tonight. :)
Title: Re: Template parse error
Post by: Itchigotim on May 15, 2013, 10:16:22 PM
Thank you, I really appreciate it. :)
Title: Re: Template parse error
Post by: Kindred on May 15, 2013, 11:33:46 PM
holy moly....

I ate to say it, but your site is REALLY messed up.

You have issues with packages.template.php as well as your originally note issue with profile.template.php.
You have dozens of errors dropped into the error log with each page load.

At this point, your best bet would be to reset your forum files to default and then reinstall the mods that you need, one by one -- being read to restore a backup when then mod which messed up hits again.

If you are willing to give me your ftp login info, I will see what I can do for you.
Title: Re: Template parse error
Post by: Itchigotim on May 16, 2013, 09:31:26 AM
Pm sent. Thank you!
Title: Re: Template parse error
Post by: RoguePin on May 16, 2013, 02:44:30 PM
Thanks, Kindred, and every1 else for your assistance.

It seems inevitable that a full wipe and fresh reinstall of SMF will be best at this time. Then rebuild one package at a time, as you suggest.

"I say we take off and nuke the entire site from orbit ... it's the only way to be sure." - Ripley, Aliens

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.pintrepid.com%2Fimages%2Fsmiley-face-matrix-006.gif&hash=4aba544fa259bfcdd3451173a48ae8033ab4ff2d)
Title: Re: Template parse error
Post by: RoguePin on May 19, 2013, 03:29:44 AM
UPDATE:

Damn ... I'm encountering very strong resistance in trying to resolve these Template Parse Errors.

A wipe and fresh reinstall of SMF won't work with a populated dbase. The installer suggests that I should use the Upgrader. I'm going to try that next ... but I don't know if simply upgrading the install will work. I'm thinking I'll still have the Parse Errors.

In FTP, I've removed all duplicate files ("index.template.php~", and all other dupe files with the ".php~" ext) from the ./Sources and other dirs. No effect; TPEs persist.

I've tried using the "repair_settings.php". No effect; TPEs persist.

QuoteTemplate Parse Error!

There was a problem loading the /Themes/default/Profile.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly.

You may want to try to refresh this page or use the default theme.

The TPEs are affecting this "profile.template.php" file, as well as other files depending on what function within the forum generated the error. When I look at the .php files, I don't see where the error is. I do have a limited understanding of PHP ... but the lines that are specified in the error logs look fine to me.

I don't understand the part about "single quotes (') have to be escaped with a slash (\)". There are over 3000 lines of code in the Subs.php file, which, up until recently, have been working for several months. Much of the code uses single quotes extensively. Would all those 3000+ lines have to be "escaped with  a slash (\)"?! If so, why was it working previously, and is not working now? Has the code been changed (I think this unlikely)?

Here's an example from the Error Logs:

QuoteURL: http://roguepinball.com/index.php?board=6.08
Error: Undefined variable: header_doneFile
File: /home/trepadmn/public_html/roguepinball.com/Sources/Subs.php
Line: 2916

Here's the handler that starts at Line 2916:

$do_header = $header === null ? !$header_done : $header;
if ($do_footer === null)
$do_footer = $do_header;


My PHP skills are limited ... but this appears ok to me; I don't see where the error is occurring.

I'm running out of ideas. If you, Kindred, or anyone else, would be kind enough to get into it in FTP and see where we went wrong, both Tim and I would be very grateful. Kindred, if you've rec'd Tim's access info, that should work. Or let me know and I can resend it in PM. Thanks.
Title: Re: Template parse error
Post by: Antechinus on May 19, 2013, 03:32:37 AM
Using a large upgrade pack will overwrite all your existing files, so that means no more parse errors. :)

First thing is to try it with just uploading the files, and without actually running the upgrade script. You shouldn't need to run the upgrade script. You just need fresh files.
Title: Re: Template parse error
Post by: Kindred on May 19, 2013, 09:20:50 AM
ummm....   darn.

By deleting those files, you have made my update for you somewhat harder, since I no longer know which of your files were updated by mods or not. anyway...

I am doing an ftp right now....


OK...  and now I am having a definite WTF moment...
fresh files have been loaded.
temporarily disabled the custom theme
forum cache was cleared
local cache was cleared...
and I *STILL* get a parse error on various template files

I may need access to your cpanel so I can get into the database to disable some of the mods which now may be partially installed...
Title: Re: Template parse error
Post by: MrPhil on May 19, 2013, 09:39:05 AM
Quote from: RoguePin on May 19, 2013, 03:29:44 AM
A wipe and fresh reinstall of SMF won't work with a populated dbase.
Don't reinstall SMF. It's a different operation to overwrite your files with the contents of the Large Upgrade package (zip file). You will end up with a working, albeit "vanilla" version of SMF. From there you can start re-installing your mods. To install/reinstall SMF will wipe out your database, losing all the members and their posts.

QuoteIn FTP, I've removed all duplicate files ("index.template.php~", and all other dupe files with the ".php~" ext) from the ./Sources and other dirs. No effect; TPEs persist.
No surprise there. php~ files are backups of your php files, saved when you installed a mod. They are not used, and can be erased once you are confident that your mod install is good and you will not be needing to roll back the mod installation.

QuoteI've tried using the "repair_settings.php". No effect; TPEs persist.
Unlikely to have any effect, but worth a try.

Quote
I don't understand the part about "single quotes (') have to be escaped with a slash (\)". There are over 3000 lines of code in the Subs.php file, which, up until recently, have been working for several months. Much of the code uses single quotes extensively.

Would all those 3000+ lines have to be "escaped with  a slash (\)"?! If so, why was it working previously, and is not working now?
No, no, no, no. Only if you have single quotes within a single-quote-delimited string do you need to escape the inner quotes. E.g.,
echo 'Please don't eat the daisies.';
is bad because the ' in don't ends the string (Please don) and PHP will wonder what to do with the "t".
echo 'Please don\'t eat the daisies.';
is OK because the ' in don't will not be recognized as "special" (i.e., ending a string).

Quote
Here's an example from the Error Logs:

QuoteURL: http://roguepinball.com/index.php?board=6.08
Error: Undefined variable: header_doneFile
File: /home/trepadmn/public_html/roguepinball.com/Sources/Subs.php
Line: 2916
Most likely an incomplete mod installation or removal. You're missing the code that defines the variable $header_done. It might be in this file or it might be in another file.
Title: Re: Template parse error
Post by: Kindred on May 19, 2013, 10:37:06 AM
Mr Phil,

(if you read the next message) I did a replace of all their files. The template error still exists, even with clean files.
At this point, I am boggled... unless there is a server-side cache that is not controlled by SMF.
Title: Re: Template parse error
Post by: MrPhil on May 19, 2013, 11:11:54 AM
Well, vanilla SMF only has about 3 lines involving $header_done, all in Subs.php. You've cleared out their SMF cache, too? Everyone has cleared their browser caches?
Title: Re: Template parse error
Post by: Kindred on May 19, 2013, 11:16:40 AM
I know...   it's the strangest thing I have ever seen.

I have confirmed that all files in FTP are showing new dates and the correct bytes to reflect the clean files.
I have cleared the browser and the SMF cache...

I am scratching my head at this point...
Title: Re: Template parse error
Post by: Shambles on May 19, 2013, 11:29:14 AM
^-- could some code be getting hoicked in during a hook call (ie, reference calls lodged in the DB) ?
Title: Re: Template parse error
Post by: Kindred on May 19, 2013, 11:31:39 AM
that is why I have asked the site owners for access to the database

I suspect tapatalk, at this point...
Title: Re: Template parse error
Post by: Itchigotim on May 19, 2013, 08:09:31 PM
I know I can't contribute much, but I wanted to say Thank You. Even if the worst happens, the support here is top notch. :)
Tim
Title: Re: Template parse error
Post by: Itchigotim on May 21, 2013, 06:06:30 PM
I'm just checking back, as I'm not in the loop. Is there light at the end of this tunnel?
Title: Re: Template parse error
Post by: Kindred on May 21, 2013, 07:34:17 PM
I am still somewhat stumped. I have one more thing that I can try, but it may take and hour or two, so I won't be ale to try it until this weekend.
Title: Re: Template parse error
Post by: RoguePin on May 21, 2013, 11:34:28 PM
Thanks, Kindred, we'll wait for your word, then. I appreciate your help.

But I can't see what's happened anywhere, whether SMF or MySQL, or the server. Can't see if it's one of the Packages that was added or not.

Very strange ... I see that others have had Template Parse Errors before ... how'd they resolve their issues, and why isn't that working for us? This is what I'll be researching to find out. Very interested to find out where we screwed up with our site.
Title: Re: Template parse error
Post by: Itchigotim on May 23, 2013, 08:24:06 PM
I heard this was fixed. I just wanted to say...
Marked as solved.

Title: Re: Template parse error
Post by: RoguePin on May 24, 2013, 01:39:05 AM
Yes, this appears to have been resolved. It is a very big relief to see the site mostly intact with no more of the Parse Errors! Thanks very much to Kindred ... u r a sitesaver!  :)

It appears that, since there are no Packages installed at this time, that the problem must have been with one of them.

How were you able to uninstall the Packages and restore access to the Admin areas? It appears that some of the SMF files were updated with fresh copies. But we had tried that previously ... what did you do differently this time?

Please let me know if you are finished with the site at this time. Also, please let us know what was wrong and how to avoid repeating these errors going forward.

Thanks again for your assistance!
Title: Re: Template parse error
Post by: Kindred on May 24, 2013, 05:55:42 AM
I should be all set. :)

I basically deleted everything that was not a core file and worked from there.
Apply your mods one by one... backing up in between. :)


BTW: It seems to me that you may have a server cache hidden away somewhere which is outside of SMF since it took a while for changes to display.