PHP newbie needs help...

Out of context: Reply #1

  • Started
  • Last post
  • 6 Responses
  • chivas0

    function get_img($page) {
    switch($page) {
    case is_home():
    $pic_num="0";
    break;
    case 48:
    $pic_num="1";
    break;
    case 50:
    $pic_num="2";
    break;
    case 52:
    $pic_num="3";
    break;
    case 54:
    $pic_num="4";
    break;
    default:
    $pic_num="5";
    break;
    }
    return bloginfo('template_url') . '/img/pic-sidebar' . $pic_num . '.gif';
    }

    // call an image like this
    echo '<img src="' . get_image(48) . '" width="200" name="MyImage" />';

View thread