So, here’s the situation.  I have a bunch of images, and each image has a larger version and some rich text content to go with it, that needs to be opened in a modal window.  All the related content for each image sits within the page, so I need to use inline content.  I am also using Colorbox for the modal window.  I had a hellofva time finding an appropriate tutorial and example for this online.  A lot of people are trying to do similar things, but there’s either no solution or what they want isn’t close enough to what I’m trying to accomplish.  Every photo needs to have its own link AND still be in a prev/next slider once the modal opens.

After a lot of trial and error, I figured out how to do it.  So here goes:

THE HTML

For your links themselves:

  <a href="#preview1" class="preview">Preview 1</a>
  <a href="#preview2" class="preview">Preview 2</a>
  <a href="#preview2" class="preview">Preview 3</a>

For the inline content boxes:

<div style="display:none">
    <div id="preview1" rel="previewBox">
          <div>Awesome HTML Content</div>
    </div>
    <div id="preview2" rel="previewBox">
          <div>Awesome HTML Content</div>
    </div>
    <div id="preview2" rel="previewBox">
          <div>Awesome HTML Content</div>
    </div>
</div>

THE JAVASCRIPT

<script type="text/javascript">

  $(document).ready(function() {

    $(".preview").colorbox({
      open:false,
      inline:true,
      html: function() {
          var div = $(this).attr('href'); return $(div).html();
      },
      href: $(this).attr('href'),
      rel: 'previewBox'
    });

  });

</script>

Anyway, here’s hoping this saves someone some time! This was done successfully with Colorbox 1.3.17.2 and jQuery 1.4.1.

I can’t tell you how many times I’ve struggled with custom submit buttons for forms.  The problem is that IE6 and IE7 don’t honor the negative text-indent value… So whatever is in the <input>’s value field shows up no matter what!!  I stumbled upon this website today that explains how to solve this problem. http://www.productivedreams.com/ie-not-intepreting-text-indent-on-submit-buttons/

I am forever grateful and rather ashamed of myself for not figuring this out sooner :)  Thank you, Productive Dreams!

Forget crying your way through Google’s expansive and complicated custom search API documentation! Just check out this amusing and well-written article on Dev-tips about how to get a custom search up and running in 10 minutes! This really got me out of a jam :)

PHP Tip: Add Custom Google Search Results to Your Site with PHP

Here’s a fun discovery I made last week!! Â In the past if I needed to test a website on the production server I just made a dev.domainname.com site, or I got an IP address to use for a month until it was ready to go live.

While working with a colleague on a website going live, he opted to use GoDaddy’s free preview service, previewdns.  The website we were testing was a PHP/Mysql/Apache on Linux server running off  Drupal 6.0.  A bunch of things in the admin went wonky.  All the collapsible menu features stopped working, so did the WYSIWYG.  We had countless issues with anything involving Javascript.  Imagine our consternation trying to figure out how so much could be different on a practically identical server!  Turns out, it’s previewdns’s fault.  Once moved over to the live domain name, all these issues were fixed.  Maybe next time I’ll just spend a buck on an IP address and be sure of what I’m seeing :)

I’m trying to find some articles that explain how and why previewdns is breaking everything – but only positive reviews exist so far! Â Spread the word! Let me know if you have had any issues or find any articles on how to deal with these problems.

I’ve run across this problem many times in my career with WordPress – suddenly the page-edit.php screen or the page-new.php screen starts loading up blank. This is a very common problem that has a LOT of solutions. Deactivate plugins, deactivate your theme, and so on. But for the first time ever, this was not the problem for me.

After some creative sleuthing, I discovered that if I had less than 56 pages in the database the problem went away. This naturally led me to check PHP’s memory limit, and sure enough it was set to 16M! I also turned on errors and got this lovely note: “Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 58368 bytes) in /wp-admin/menu-header.php on line 84

So short story shorter, check your memory limit! 16M is pretty small for any website running off a database. Â I would just like to add that to the long list of things to check. Â Here’s a good article on increasing memory limit.

Pretty simple problem. I wanted to use the jCarousel plugin for jQuery to have a scrolling list of items, using the ‘circular’ wrap, where you never reach an end. See: circular carousel, but I also wanted to use Thickbox, so that if someone clicks on the image, it opens up a modal window with more information. Carousel already comes with an example that uses thickbox, but it’s not for the circular carousel, just the linear one. See: jCarousel with Thickbox 3. Since the code here is different, applying tb_init(item) doesn’t work.

I scoured the internet, and got extremely discouraged as all threads on this topic either end with someone saying “Forget it, I just gave up” or the dreaded no response. So, like all big problems, I slept on it and awoke with a brilliant and obvious solution: force it.

Assuming you’re already familar with the methods of Thickbox, take yourself to the jCarousel function mycarousel_getItemHTML. Within this is the code where you would expect to add class=”thickbox” on the a tag and get the magic results. This won’t work.  Instead of having this:

return '<a href="#TB_inline?height=155&width=300&inlineId=
hiddenModalContent" title="' + item.title + '">
<img src="' + item.url + '" width="75" height="75" border="0"
alt="' + item.title + '" /></a>';

I put in a force call to the Thickbox function that intiates the window onclick:

return ‘<a href=”#” onclick=”tb_show(‘‘ + item.title + ‘‘, ‘#TB_inline?height=155&width=300&inlineId=hiddenModalContent’,'false’); return false;“><img src=”‘ + item.url + ‘” border=”0″ alt=”‘ + item.title + ‘” width=”75″ height=”75″ /></a>’;

Let’s break that down:

tb_show
Thickbox function that opens a modal window, takes 3 arguments

'" + item.title + "'
Here we assign the first argument to be the title tag you assigned in mycarousel_itemList
This will also be what shows as the title in your thickbox window

'#TB_inline?height=650&width=600&inlineId=contentid'
We’ve taken the normal href code from the a tag and stuck it into the second argument of the tb_show call instead! This simply works the same way as putting it in the href does, it just skips a few steps.

false
Not sure, but just make it false :)

return false;
I’ve added this in to make sure the browser doesn’t try to go to your blank link, now that the href is empty. returning false; will keep the browser where it is and enable your viewers to see your modal window.

I needed a way to display submenus on pages on a website built in Drupal 6. The menu system itself, built with Drupal Menu’s primary links, was three levels deep. So, a small snippet of the menu as an example would be:

About Us >
    Directors
    History
    Mission
Services >
    Pricing
    Administration
        Trusts
        Estates
    Special Needs

If someone is on the “History” page, I want a sub menu to appear on the left with all the other links that appear under “About”. Drupal has a module called Submenu Tree which comes with hardly any instructions, and didn’t seem to work. So after much digging around, I found a quick and simple solution using some Drupal functions and the template.php file.

In my theme’s template.php file I created a new function called Submenu() that looks like this:

<?php

function Submenu() {

$menu_theme = menu_navigation_links(“primary-links”,2);
$menu .= “<ul>”;

foreach ($menu_theme as $value) {
  $menu .= “<li>”;
  $menu .= l($value['title'],$value['href']);
  $menu .= “</li>”;
}

$menu .= “</ul>”;
return $menu;
}

Then, in your page.tpl.php file, whereever you want the menus to appear, just do a print(Submenu()); and voi-la!!

The code explained:

$menu_theme = menu_navigation_links(“primary-links”,2);

This is a drupal function that will return an array of all the links relative to the current menu, the second argument, the ’2′, says I want to see all the links for the 3rd level. If I was on the “Trusts” page, this would return an array with “Trusts” and “Estate” link information.

$menu .= l($value['title'],$value['href']);

This is another Drupal function that creates an automatic link based off link text and a path URL. Both of these are made available to us from the array we got in $menu_theme.

I’ve been having one bad experience after the other with them lately. Today I got so pissed off I was encouraged to blog about it. I want to make sure people know this before they make the same mistake.

I love GoDaddy as a hosting company. I use their shared hosting for almost all my sites. And I recommend them to all of my clients.  In fact, I’ve probably done more business for GoDaddy than their latest superbowl advertisement. They’re fast, reliable, cheap, and friendly. I would say they have the best deal on the market today for web hosting- if you had asked me 2 weeks ago.

See, 2 weeks ago I signed up for a Virtual Dedicated and a Dedicated hosting account. This was my first time venturing into this world with Godaddy. As a web developer, I have had several times where I was constrained from doing something too terribly awesome because of the limitations of shared hosting. It was time to move into something more freeing.

I’ve worked with several other hosting companies and in-office servers with literally all-access server administration. So signing up to pay GoDaddy ~$400/month for their best plan available, I was a little more than disappointed to see all the limitations I still faced. You still have to jump through all of GoDaddy’s covering-their-butt hoops, and unless you sign up for their $100+/month support plan, good luck getting them to answer ANY of your questions, no matter how basic.

Their control panel is clunky and confusing. Unless you want to unix command line your way through your entire experience, good luck figuring out how to make any changes to your server. If you do go the commandline route, there is no such thing as root level access. You have to jump through more hoops to get that access: every time you connect. Setting up FTP and databases is very confusing, too. But the worst part of all? Customer support.

They have this great feature from your hosting account page that allows you to chat online with a representative. And the wait is never very long. But it only takes one chat session to figure out why: the people you get are, quite frankly, assholes. I have never had such a horrible customer service experience than this, outside of Comcast of course. Over the past two weeks, I have been on several phone calls, and several online chat sessions with rude, selfish, over-protective, impatient dicks who have all treated me like a peice of shit stuck on their heel. They don’t answer any questions directly. Infact, I’ve never had any of my questions answered. When I said “My root password isn’t working”, they said “It worked for me.”  Great, thanks, Sherlock. They are not proactive or helpful in the least as any decent customer support rep should be. It’s almost like they’re mocking your stupidity for not being able to understand their horribly unituitive structure. They either tell you no or throw canned reponses your way, hoping you’ll get out of their hair.  I have become so enraged by these people, I think I will be switching services soon.

So, maybe things would be better if you got the support option. But from what I have heard, that gives GoDaddy full control. So it’s like having a server you can do anything on, except you can’t actually do it yourself. Everything has to be done by a GoDaddy technician so as to rule out you coming to them to complain that something is broken. To summarize, there is no such thing as “technical” support for GoDaddy, even if you purchase it, they’re never EVER going to tell you “HOW” to do something. This is just a waste of time and resources. If you need to know a how you can try searching through their extremely basic and inefficient resources. If GoDaddy wanted a piece of advice from me I’d tell them to expand their FAQ section to answer questions more directly and in greater detail, as I can’t imagine how they’re helpful to anyone, no matter how intelligent.

For my clients who want a very simple site that doesn’t do anything spectacular, I will continue to recommend GoDaddy. But if you’re like me, and need a blue sky, I would strongly dissuade you from signing up for GoDaddys clauserphobic and nazi hosting plans.

I had a client who needed to add a captcha to their contact form in WordPress. Only problem was, they were running WordPress 2.3 which was very outdated, and for other reasons they couldn’t upgrade. I found this one and only plugin which has CAPTCHA and keeps its older versions in stock.  Contact Form 7 version 1.5 does the trick quite nicely. :)

Someone’s finally done it. They’ve gone and made a plugin for CS3 that allows you to save favico’s! I think my life is complete! Check it out:

http://www.telegraphics.com.au/sw/

Recent Comments

Great Resources

Meta

@christiemade