WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] img src= ?php include TEMPLATEPATH… gets big mess

[Resolved] img src= ?php include TEMPLATEPATH… gets big mess

  • 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’); ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • whooami

    @whooami

    Member

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

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

    thats NEVER going to work.

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

    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!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] img src= ?php include TEMPLATEPATH… gets big mess’ is closed to new replies.