X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Killer error in Smarty, PLEASE HELP! (https://forum.x-cart.com/showthread.php?t=19)

Anonymous 09-18-2002 06:29 PM

Killer error in Smarty, PLEASE HELP!
 
In home.php, I've got the default display statement to include home.tpl:

$smarty->display("customer/home.tpl");

In home.tpl, I've got a bunch of code that was working an hour ago (actually this doesn't matter, as I'll explain). When I try to view home.php, I get this error:

Parse error: parse error, expecting `'}'' in //templates_c/151/1512206380/0.php on line 162

This actually comes on line 641 of Smarty.class.php, where it includes the compiled php file. So I would figure that there's an error in home.tpl, but I can delete EVERYTHING from home.tpl (i.e. it's an empty file) and I still get this error.

I've tried clearing the cache, I've tried clearing the templates, etc., but I have to do it all through PHP calls to clear_cache(), clear_all_cache(), and clear_compiled_tpl(), since the owner's set on the cache directories to nobody. How can I get at this file and figure out where that error is occurring? This is KILLING my development, I can't do ANYTHING.

Actually as a follow-up, I just figured out that I can't view ANY of my files. product.php gives me EXACTLY the same error. What's going on here?

B00MER 09-18-2002 07:15 PM

How are you clearing your templates_c? This is usually my culprit, so I normally just do:
Code:

rm -R templates_c; mkdir templates_c; chown nobody.nobody templates_c; chmod 776 templates_c

Hth. :wink:

Anonymous 09-18-2002 08:22 PM

Quote:

Originally Posted by B00MER
How are you clearing your templates_c? This is usually my culprit, so I normally just do:
Code:

rm -R templates_c; mkdir templates_c; chown nobody.nobody templates_c; chmod 776 templates_c


The problem is that I'm on an ISP, so I can't directly rm that directory. I'm not nobody (there's something to make me feel good!), so I can't get in there. The perms are actually 771, so I can't view or modify those files.

So what I did was use the smarty clear_*() functions, but they either don't seem to clear this template from the cache or somehow the template's being regenerated with an error every time.

Does this look like an error you've seen before? Did rm'ing the cache directory fix it? If so, I can just have the tech at the ISP rm that directory and see what happens...

Oddly, this happens to EVERY file in the /xcart/customer directory, but the /xcart/admin directory works fine.

jpsowin 09-18-2002 08:27 PM

When you go into the template editor and hit "Save" it deletes any old templates relating to the file you saved. I've had the same problem, but it was because I really just missed a closing smarty tag.

B00MER 09-18-2002 08:42 PM

In version 3.1.* if you run cleanup.php should do the same as I mentioned above.

Code:

<?
chdir("templates_c");
system("rm -rf -- .* *");
?>
The compiled templates cache ("templates_c" directory) has been cleaned up.


syddos 09-19-2002 03:44 AM

Killer error in Smarty, PLEASE HELP!
 
I have had this problem several times, when trying to produce a homepage for my site, using the xcart engine.

I discovered 2 errors which SEEM to be the cause.

1. I was using "(" and ")" instead of "{" and "}"

2. I had left "White lines" at the end of some of the long PHP files I changed, then changed back. However noen of this is revelant if you cant access the files on your clients server.

Regards,

Syddos

Anonymous 09-19-2002 06:42 AM

Re: Killer error in Smarty, PLEASE HELP!
 
Quote:

Originally Posted by syddos
I have had this problem several times, when trying to produce a homepage for my site, using the xcart engine.

I discovered 2 errors which SEEM to be the cause.

1. I was using "(" and ")" instead of "{" and "}"


Here's the problem: when I access home.php, everything's fine up to this line:

Code:

$smarty->display("customer/home.tpl");

If I remove that line, I get nothing (well, duh). When I put it in, I get this:

Code:

Warning: Smarty error: problem writing '../templates_c/151/1512206380/0.php.' in //Smarty-2.1.1/Smarty.class.php on line 546

Parse error: parse error, expecting `'}'' in //templates_c/151/1512206380/0.php on line 162

Warning: Smarty error: problem writing '../templates_c/527/527896370/0.php.' in //Smarty-2.1.1/Smarty.class.php on line 546


Now, I get this EVEN if home.tpl is completely empty. It's not contingent on what's there, apparently. The error actually comes in the Smarty.class.php file, on line 641, which looks like this:

Code:

include($_smarty_compile_path);

The value of $_smarty_compile_path is "templates_c/151/1512206380/0.php," the file that gives me the error. The biggest problem is that I can't get in there and see what's going on in templates_c/151/1512206380/0.php. That might give me some information on where the error's occurring, but I can't get at the file.

Quote:

Originally Posted by syddos
2. I had left "White lines" at the end of some of the long PHP files I changed, then changed back. However noen of this is revelant if you cant access the files on your clients server.


Don't misunderstand me, I can access the php and tpl files and so on just fine. It's the cache files in the templates_c directory that I can't access. I tried checking for extra lines, checking the '{' and '}' delimiters and so on and get no luck there.

Rick Herrick 09-19-2002 06:57 AM

Re: Killer error in Smarty, PLEASE HELP!
 
Quote:

Originally Posted by Anonymous
Here's the problem: when I access home.php, everything's fine up to this line:


OK, to follow up (I was the Guest that started the whole thread; I thought I was logged in through x-cart's site!), it's now working. What was the problem? Well... I don't know. I had the sysadmin at my ISP change the perms on the templates_c subdirectories so that I owned them. I then changed the perms to 777 so that x-cart/smarty could access them. And suddenly everything worked again. No changes in code, nothing except changing the perms on the directories. Which is NOT what I was hoping for from the perms change. I was just hoping to be able to go check out the files in the cache.

Quite honestly, I have no idea what that was all about.

Rick Herrick 09-19-2002 06:59 AM

Re: Killer error in Smarty, PLEASE HELP!
 
BTW, I wanted to add, thanks a lot for all your help in here! While the problem apparently ended up being something else, it was nice to have a touchstone and some suggestions on things to do! My wife was getting a bit upset at my screaming and beating on the keyboard last night :lol:

minorgod 09-20-2002 12:08 PM

How to delete stubborn X-Cart directories.
 
How to delete stubborn X-Cart directories.

I also posted most of this info in the other Smarty Templates & PHP topic I saw, but I fogot to mention one thing about WSFTP. You may have noticed a square white box in the WSFTP user interface just below the MkDIR button when you're browsing your FTP directories. If you enter the following characters without the quotes, it will list EVERYTHING in the directory, including hidden files: "-a".

For everyone's info...you cannot delete any files that are generated by PHP (eg: templates_c) because the file and directory owner are set to the Apache user "nobody" by default. The only way to delete such files is either to have root access to your server, which few people do, or to write a PHP script to delete the files. Usually, you can delete the files you need to delete through X-Cart's template editor or file manager, but if X-Cart is broken, then you're out of luck. In that case you'll need to change the name of the directory you can't delete (which you usually CAN do, even if you're not the owner) and make a new directory with the right name, CHMOD it to whatever you want and then fill it up with whatever you need to. Your other option is to call your ISP and ask them to delete the file(s)/folder(s).

I think the X-Cart folks might be wise to include a separate file manager script with X-Cart for this specific purpose, although you can grab an excellent one from www.hotscripts.com.


All times are GMT -8. The time now is 04:29 AM.

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