embedding CSS in PHP, example, please look

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kard63
    Confirmed User
    • Nov 2003
    • 8944

    #1

    embedding CSS in PHP, example, please look

    print "<IMG STYLE="position:absolute; TOP:35px; LEFT:170px; WIDTH:50px; HEIGHT:50px" SRC="hair$hair.gif">";



    Whats wrong with that line? thanks.
  • Chio
    Confirmed User
    • Oct 2002
    • 8002

    #2
    Originally posted by Kard63
    print "<IMG STYLE="position:absolute; TOP:35px; LEFT:170px; WIDTH:50px; HEIGHT:50px" SRC="hair$hair.gif">";



    Whats wrong with that line? thanks.
    I'm not a coder at all but maybe you need to escape out some of those characters?

    I seo'd my hair yesterday and today it's pr7!
    RIP Texas Dreams

    Are you a content producer or program owner sick of tube sites? Contact me on ICQ: 39-183769

    Comment

    • Kard63
      Confirmed User
      • Nov 2003
      • 8944

      #3
      the line:

      print "<img src = hair$hair.gif>";

      works. but when I try to add CSS it goes to shit.

      Comment

      • DjSap
        Confirmed User
        • Jul 2002
        • 3869

        #4
        A. You do not fucking do that, all styles go into the CSS file, no hardcoding

        print "<IMG class='imgstyle' SRC='hair$hair.gif'>";
        Blog Themes, TGP Design, Writing Services, Grunt Work
        ICQ: 66871495

        Comment

        • naitirps
          Confirmed User
          • May 2004
          • 761

          #5
          try this:

          echo "<IMG STYLE=\"position:absolute; TOP:35px; LEFT:170px; WIDTH:50px; HEIGHT:50px\" SRC=\"hair".$hair.".gif\">";
          Programmer
          ICQ 44035273 | AIM spritwork | Email spritian at spritian dot com

          Comment

          • Kard63
            Confirmed User
            • Nov 2003
            • 8944

            #6
            Originally posted by naitirps
            try this:

            echo "<IMG STYLE=\"position:absolute; TOP:35px; LEFT:170px; WIDTH:50px; HEIGHT:50px\" SRC=\"hair".$hair.".gif\">";
            It worked beautifully. Thank you very much!

            If you could explain I would cream my pants, but if you cant I am still insanely grateful. Thanks again.

            Comment

            • octane
              Confirmed User
              • Mar 2006
              • 32

              #7
              you can't use the same type of quotes (in this case double quotes) inside the string you're trying to print without escaping them.

              basically your print statement starts at the first double quote and ends at the next one, which was right after STYLE=, and that caused the error.

              Comment

              • woj
                <&(©¿©)&>
                • Jul 2002
                • 47882

                #8
                Originally posted by DjSap
                A. You do not fucking do that, all styles go into the CSS file, no hardcoding

                print "<IMG class='imgstyle' SRC='hair$hair.gif'>";

                or just escape the -> " characters
                Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
                Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
                Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager

                Comment

                • PHP-CODER-FOR-HIRE
                  Confirmed User
                  • Nov 2006
                  • 1090

                  #9
                  Originally posted by DjSap
                  A. You do not fucking do that, all styles go into the CSS file, no hardcoding

                  print "<IMG class='imgstyle' SRC='hair$hair.gif'>";
                  If you want to be like that, you shouldn't use single quotes in HTML attributes.

                  The ultimate correct way is like this:

                  echo '<img src="whatever.gif" class="super_pic" style="border: 1px solid red;" />';


                  Print is not required here, nor is escaping quotes.

                  Comment

                  Working...