Support » Fixing WordPress » PHP code "jumping" around html

  • Hi!
    I’m rather new to PHP and WP, and I have recently stumbled upon this odd behaviour. It might be some standard in PHP, but I haven’t been able to find any documentation about it.

    Here it goes. I have this rather simple code:
    echo "<img src='" . bloginfo('template_directory') . "/css/imagenes/p_2.jpg' blabla..."

    which, oddly enough, outputs this to html:
    http://localhost:8888/wp-content/themes/Starkers<img src='/css/imagenes/puntuaciones/p_2.jpg' blabla...

    As you can see, the code generated by bloginfo() jumps to the beginning of the html statement, messing the whole thing up.
    I know I could recode the whole thing as
    <img src="<?php echo bloginfo(); ?>" ectcetera>
    but I’d rather not do it, because it’s located in a php chunck of code which would get quite messy if I did.

    Am I doing anything wrong?
    Thanks a lot.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP code "jumping" around html’ is closed to new replies.