joe codes

x-cart guru & custom programmer

  • About
  • Archives
  • Contact

Powered by Genesis

Smarty preg_match

September 24, 2018 by joecodes Leave a Comment

This was not obvious to me nor apparently anyone else trying to use preg_match in Smarty so I thought I’d share the solution. Given $href=’home.php?cat=1′ and trying to get 1 out of it:

{if "/cat=(\d+)/"|preg_match:$href:$match}
  {$href = "My-Page-`$match.1`.html"}
{/if}

[Read more…]

Filed Under: Programming Tagged With: Smarty

Smarty Strip

October 30, 2008 by joecodes Leave a Comment

If you are a Smarty expert then this will be very dumb. I knew about the cool Smarty tag, strip, but hadn’t found a really good use for it. When you are using Smarty you are changing the how the HTML is created when the page is loaded. In some cases, how the code is formatted affects how the browser displays it, especially for IE. One of the most common areas I’ve seen this is when formatting using an indented structure and having an image at the end of a block. By having the closing block tag (/div, /td, etc.) on a new line an extra bit of space is added behind or below the image. This extra space is usually noticeable and causes page rendering differences among browsers. Here is an example of this piece of code:

    <img src="myimage.gif" alt="" />
</div>

[Read more…]

Filed Under: Programming Tagged With: Mason, Smarty

My New Blog

June 24, 2007 by joecodes Leave a Comment

A look-at-my-new-blog post is pretty typical for a first post, but I really do want you to look at mine. It’s because my awesome wife designed it as a surprise just for me! I had mentioned wanting to start a blog and she came up with this design. It’s just another excellent example of her great sense of design and ability. Thanks Cherie!

[Read more…]

Filed Under: Personal, Programming Tagged With: Apple, Perl, PHP, Smarty

Quick Thoughts

  • I was surprised to learn that foreach in JavaScript does not have a traditional break. The loop will run to completion.

  • Who knew that combination sums across all permutation lengths of an array would be so difficult? It was a challenge but the final product looks good and takes a lot of resources. Limiting the max length for basic memory limits. Would only do something like this for occasional reporting.

  • Working on a new project that can have hundreds of forms on a page. The browser was spending way too much time in Parse HTML. Wasted a bunch of time before learning this is a long-standing bug in Chrome when there are many forms or inputs. Other browsers are fine.

Recent Posts

  • MacBook External DVD Player
  • Progressive Enhancement
  • Keychain Password Search
  • Smarty preg_match
  • iPhone Plus Experiment

Tag Cloud

Apple JavaScript Mason Perl PHP security simple Smarty speed stability Tax WWDC X-Cart

Search

Subscribe

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Recent Comments

  • Bad App Alert on Startup Item Help
  • iPhone Pre-Order Needs to Change on iPhone Pre-Order Warning
  • Apple vs Pro on My Personal Three S’s of Development