Linking image to URL using PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • brucehere
    New Member
    • Nov 2007
    • 6

    Linking image to URL using PHP

    hi,
    this is my current php code which displays an image.

    [HTML]<span class='floatRig ht'>
    Sponsors: <img src='".THEME."i mages/logo1.gif' />

    </span>[/HTML]

    Now i want that displayed image to link to a certain external URL.
    How would i do this?
  • mwasif
    Recognized Expert Contributor
    • Jul 2006
    • 802

    #2
    Put <a></a> around the image
    [CODE=html]<span class='floatRig ht'>
    Sponsors: <a href='http://www.some-domain.com/page.html'><img src='".THEME."i mages/logo1.gif' /></a>

    </span>[/CODE]

    Checkout this page for details.
    Last edited by mwasif; Nov 13 '07, 06:35 PM. Reason: Added link

    Comment

    • brucehere
      New Member
      • Nov 2007
      • 6

      #3
      i just get the following error when i put that code in:

      "Parse error: parse error, unexpected T_STRING in..."

      The code in dreamweaver also doesnt look right? like it goes all orange and stuff, not the usual red and black im used to for php code.
      so must be another way of writing that code...?

      Thanks for trying though, any other suggestions?

      ps. i maybe also forgot to add that my image tag is within php code.

      Comment

      • mwasif
        Recognized Expert Contributor
        • Jul 2006
        • 802

        #4
        You need to take care of the quotes. If you are facing problem, post your PHP code so that I can suggest something.

        Comment

        • brucehere
          New Member
          • Nov 2007
          • 6

          #5
          This is that block of code:
          [HTML]$FOOTER = "
          </div>
          </div>
          </div>
          <div id='footer'>

          <div id='width'>
          <span class='floatLef t'>
          {SITEDISCLAIMER }
          </span>
          <span class='floatRig ht'>
          Sponsors: <img src='".THEME."i mages/logo1.gif' />

          </span>
          </div>
          </div>
          ";[/HTML]

          thanks, much help appreciated!

          Comment

          • mwasif
            Recognized Expert Contributor
            • Jul 2006
            • 802

            #6
            Did you embed the code I suggested? Make sure you keep single quotes around the URL.
            Code:
            <a href='http://www.some-domain.com/page.html'><img src='".THEME."images/logo1.gif' /></a>
            If you still face any problem, then post your code with changes.

            Comment

            • brucehere
              New Member
              • Nov 2007
              • 6

              #7
              epic!
              it works
              thanks alot!!
              really appreciate it!

              Comment

              • mwasif
                Recognized Expert Contributor
                • Jul 2006
                • 802

                #8
                Welcome!

                Glad to help you.

                Comment

                Working...