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

bad tpl formatting help?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 01-20-2008, 09:51 AM
 
spencoid spencoid is offline
 

Advanced Member
  
Join Date: Jan 2008
Posts: 36
 

Default bad tpl formatting help?

I am not a great programmer but can figure out most things pretty well. I have been trying to edit some .tpl files and have found it very difficult. The formatting of the default files is horrible, many levels of nested ifs without indentation and lack of line breaks in reasonable places make it impossible for me. I can't imagine that the original files were constructed in this sloppy formatting. Have they been jumbled to make them unreadable? I can not find an editor anywhere that will provide highlighting or other methods of making ssense of them. Is there a source for files that are formatted well? An editor that will fix up the mess, or do I just have to start by formatting the files myself? I can wrote some perl scripts to do this but I really hope that I don't have to spend the time doing this or reformatting each file.
__________________
xcart version 4.1.9
Reply With Quote
  #2  
Old 01-20-2008, 10:26 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: bad tpl formatting help?

Unfortunately that is the way they have always been
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 01-20-2008, 10:36 AM
 
spencoid spencoid is offline
 

Advanced Member
  
Join Date: Jan 2008
Posts: 36
 

Default Re: bad tpl formatting help?

so, is the only solution to spend the time making a nicely formatted set? has anyone done that already? if not, i'll probably spend the time to write a perl scrip to tidy them up. the logic might be pretty simple. if anyone has ideas on how to do this, let me know.
__________________
xcart version 4.1.9
Reply With Quote
  #4  
Old 01-20-2008, 11:15 AM
 
levo levo is offline
 

Member
  
Join Date: Nov 2007
Location: Chicago, IL USA
Posts: 20
 

Default Re: bad tpl formatting help?

Hi,

I've used this ('tidyrepairhtml' output filter for smarty) with pretty good results:

http://www.phpinsider.com/smarty-forum/viewtopic.php?p=24456

You'll need to have tidy built as an extension to PHP, at least that's the only way I have been able to use it.

Cheers,

Nate
__________________
--
Nathan T. Harper
Nth Degree Consulting
Web Dev / E-Commerce / ID Management
X-Cart v4.1.9 + SpecialOffers + Magnifier + GiftReg + Survey + Custom tweaks
FreeBSD + Apache 2.2.6 + PHP 5.2.3 + MySQL 5.0.24
Reply With Quote
  #5  
Old 01-20-2008, 09:16 PM
 
spencoid spencoid is offline
 

Advanced Member
  
Join Date: Jan 2008
Posts: 36
 

Default Re: bad tpl formatting help?

I think I have a Perl script working that helps to make xcart .tpl files more readable. It fixes up nested if statements. So far I have only dealt with the if statements with the assumtion that else and elsif are not likely to be nested. The script seems to make a much more readable file. If there is any interest, I'll share the script and would probably take the time to add indentation for other nested statements such as for loops. Since these are not likely to be nested to the point of confusion, this might not be worth doing. I don't want to write a whole smartytidy script, just want to get the scripts so I can edit them. I can also make an exe to run the indenting script for those who are not running perl scripts.
__________________
xcart version 4.1.9
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 07:38 AM.

   

 
X-Cart forums © 2001-2020