The how and why of my programming
Posts tagged js
Geekend 2011 Notes
Nov 17th
Last Thursday night I received a call from my father telling me he was at this conference called Geekend, something I had never heard of before and had to get him to spell out for me. After about five minutes, of him talking while I was checking out the website, I was sold on it, told my bosses I’d be gone the next day and drove straight to Savannah to arrive around midnight. It was worth it.
Download: Geekend 2011 Session Notes; last updated 2011-11-17.
More >
Update: Custom Tags using jQuery 1.4.1
Aug 1st
Remember that pesky IE issue I was having with my Custom Tag for jQuery script? Well, it turns out that Internet Explorer is stuck up and just didn’t like the fact I created my own HTML tag to use… So, if you change the jTag selector to a div with a class of jTag, then everything works fine! Figures, huh?
(╯°□°)╯
$(document).ready( function() { $("div.jTag").each( function(){ var jTag = $(this); jTag.html('<img src="/images/loading.gif" alt="Loading..." />'); var jTagUrl = "http://www.example.com/CustomjQueryTags.php?"; var attrs = ['type', 'src', 'cat', 'rand', 'desc', 'limit', 'more']; $.each(attrs, function(i,a) { if(jTag.attr(a)) jTagUrl += '&'+a+'='+jTag.attr(a); }); jTag.load( jTagUrl, function() { jTag.replaceWith( jTag.html() ); } ); }); });
Custom Tags using jQuery 1.4.1
Feb 25th
So I’ve had the problem for a long while of wanting to pull database-driven items onto my already CMS controlled pages from anywhere within the page. These lists wouldn’t all be the same, and rather than worrying about have to make a separate tag for each different database table, I wanted them pretty much standardized, so I thought of using jQuery for it. (It is moments like this that I absolutely love JavaScript even though I am usually against it.
So, I did what I normally do and defined what I needed… I wanted to decided:
- What table will I be pulling the information from?
- What kind of additional parameters am I probably going to need?
- How do I want to “standardize” the look of all these different resource records into 2/3 columns per list?
I am going to ignore #3, but I figured there would be a couple different lists (events, books, comments, posts, etc…) that I might want to reference, so I made those my additional, optional fields. My tag thus became something like “<jtag type=”events”></jtag>” with the other parameters as additional attributes of the tag. The major problem was figuring how to compactly, yet simplistically generate the queries to .load() the results… After messing round with it for a couple of hours, I finally found a solution I was happy with.
More >