Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Killer error in Smarty, PLEASE HELP!

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-18-2002, 06:29 PM
 
Anonymous Anonymous is offline
 

eXpert
  
Join Date: Sep 2002
Posts: 222
 

Default 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?
Reply With Quote
  #2  
Old 09-18-2002, 07:15 PM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

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.
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #3  
Old 09-18-2002, 08:22 PM
 
Anonymous Anonymous is offline
 

eXpert
  
Join Date: Sep 2002
Posts: 222
 

Default

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.
Reply With Quote
  #4  
Old 09-18-2002, 08:27 PM
 
jpsowin jpsowin is offline
 

X-Adept
  
Join Date: Sep 2002
Posts: 459
 

Default

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.
__________________
Joshua Sowin
...taking things one TPL at a time.
Reply With Quote
  #5  
Old 09-18-2002, 08:42 PM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

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.
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #6  
Old 09-19-2002, 03:44 AM
 
syddos syddos is offline
 

eXpert
  
Join Date: Sep 2002
Location: London, England, UK
Posts: 259
 

Default 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
Reply With Quote
  #7  
Old 09-19-2002, 06:42 AM
 
Anonymous Anonymous is offline
 

eXpert
  
Join Date: Sep 2002
Posts: 222
 

Default 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.
Reply With Quote
  #8  
Old 09-19-2002, 06:57 AM
 
Rick Herrick Rick Herrick is offline
 

Member
  
Join Date: Sep 2002
Location: Lakewood, CO
Posts: 11
 

Default 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
webmaster@fantasycollections.com
Reply With Quote
  #9  
Old 09-19-2002, 06:59 AM
 
Rick Herrick Rick Herrick is offline
 

Member
  
Join Date: Sep 2002
Location: Lakewood, CO
Posts: 11
 

Default 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
__________________
Rick
webmaster@fantasycollections.com
Reply With Quote
  #10  
Old 09-20-2002, 12:08 PM
  minorgod's Avatar 
minorgod minorgod is offline
 

X-Adept
  
Join Date: Sep 2002
Location: Arivaca, AZ
Posts: 402
 

Default 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.
__________________
www.brettbrewer.com
Getting back into x-cart dev after a long hiatus. Modded lots of x-carts from version 3.1.x to 4.1.x. Developer of ImageScaler mod, Pre-login per user coupon mod, Wordpress feed mod, DigitalSubscriptions mod, Phonetic bulk download keys addon for DownloadExpander mod, Serial Number Generator for ESD products, Custom CMS/LMS integrations, external products mod, and more.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

   

 
X-Cart forums © 2001-2020