WordPress.org

Ready to get started?Download WordPress

Forums

how do i add an image in my php code? (4 posts)

  1. ILostMyDream
    Member
    Posted 9 years ago #

    In html you just say "<img src="img1.jpg"> put in php its different no? I can't find the code because I don't know what I'm looking for. Sorry for all of my stupid questions, but I've only been using php for like a week!

    Thanks :)

  2. Minna
    Member
    Posted 9 years ago #

    It would help to know the situation. If, for example, you want to include a picture only on category pages you'd write something like <?php if($cat) ?><img src="the-image.gif"/><?php } ?>. So basically you write HTML between the php tags. Or, what sort of a case you have there? :)

  3. Jez
    Member
    Posted 9 years ago #

    Yeah, you come out of PHP mode by using a PHP end tag ?> then type your HTML image tag, then re-open your php tags <?php

    And you can close then re-open your PHP tags in the middle of a conditional block (if statement etc.), as Minna says.

  4. ILostMyDream
    Member
    Posted 9 years ago #

    yeah thats what i thought but i didn't know for sure the exact way to write it :) it's basically just replacing text (xhtml being one of them) with little gif buttons, adding little image bullets... just customization really :)

    but thank you so much (again). everyone here is so helpful!

    :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.