WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] img src= ?php include TEMPLATEPATH... gets big mess (4 posts)

  1. imagiscapeca
    Member
    Posted 6 years ago #

    This works:
    <?php include(TEMPLATEPATH.'/content.php'); ?>

    This produces a ton of gobbledygook on the webpage:
    <img src="<?php include(TEMPLATEPATH.'/images/hr.gif'); ?>" />

    So does this:
    <?php include(TEMPLATEPATH.'/images/hr.gif'); ?>

    What can I do besides entering the full http://... url?

    This seems to work sometimes, I think:
    <?php include('wp-content/themes/mytheme/images/hr.gif'); ?>

    This seems to work sometimes, I think:
    <?php include('images/hr.gif'); ?>

  2. whooami
    Member
    Posted 6 years ago #

    <img src="<?php include(TEMPLATEPATH.'/images/hr.gif'); ?>" />

    you cannot use a php include to call an image file.

    thats NEVER going to work.

  3. Maxaud
    Member
    Posted 6 years ago #

    what about:
    <img src="<?php bloginfo('stylesheet_directory'); ?>/images/me.jpg" alt="picture of me" />

  4. imagiscapeca
    Member
    Posted 6 years ago #

    Thanks both -
    so php includes don't work,
    but
    <img src="<?php bloginfo('stylesheet_directory'); ?>/images/hr.gif" alt="test">
    does work.

    It works for iframes too!

Topic Closed

This topic has been closed to new replies.

About this Topic