View Single Post
  #5  
Old 05-05-2015, 04:01 PM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Truncate product title in XC5

Quote:
Originally Posted by RichieRich
Ah ok thanks mike, I was wondering the same thing, shame it can't be done in the template like before
Not really. Yes it's a bit of a pain when looking for the quick fix. But the separation of logic from presentation is the holy grail of program design.

With Smarty(XC4 template engine), we got some of that separation, but not nearly enough. I'm not a mind reader, but if I put myself in the position of the devs behind Flexy (XC5 template engine); I can see them being determined to not let Flexy turn into the mess that Smarty did.

Smarty gave designers too much power. And so rather than learn some PHP or bring in a dev, they just implemented some code in Smarty that "took care of it". Even if "taking care of it" meant 20 nested foreach loops.

This is the better way. But the learning curve is frightful for some.

A real world example of how this is better, even from a designer's standpoint: Now you have truncated the product name in 20 different templates with a Smarty call to {$product.name|truncate:30:"...":true}. And your client says "What the heck are those three dots at the end? I want those removed". You now have 20 edits to make. With a PHP method/function it's just one change.

Yeah I may be reaching with this example, but it demonstrates the point perhaps.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote