SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Web Design Addict
    Join Date
    Mar 2004
    Posts
    2,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HTML not valid because of Amazon Affiliate Links

    Hi - I'm by no means an expert coder, but I try to do the best that I can in validating everything and making things correct. But right now I've got (homepage only - haven't checked other pages) 21 Errors

    Looks to me like 20 of these errors are because of the three Amazon Affiliate Link code in the sidebar of my site. What can I do (if anything) to fix these? I'm not real clear on what the validator is even telling me.

    The first error (Line 121 column 4: end tag for "ul" which is not finished.) I'm not sure where that is coming from either. I've looked over the code as best I could and can't find an <ul> tag which is unfinished.

    If anyone has suggestions I'd appreciate it.
    Deron Sizemore
    ----------
    My Sites: LogoGala | Golf Ledger (coming soon)
    Twitter: Deron Sizemore

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    The UL error on line 121 is because the UL is empty. It must have <li>s in it (and nothing else), as the validator says in its second suggested possibility. The rest of the errors are all because you're using the ampersand & by itself and not using the correct entity &amp; in your URLs.

    In PHP you can put the URL string through htmlspecialchars() before outputting it in order to fix that.

  3. #3
    Web Design Addict
    Join Date
    Mar 2004
    Posts
    2,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Raffles View Post
    The UL error on line 121 is because the UL is empty. It must have <li>s in it (and nothing else), as the validator says in its second suggested possibility. The rest of the errors are all because you're using the ampersand & by itself and not using the correct entity &amp; in your URLs.

    In PHP you can put the URL string through htmlspecialchars() before outputting it in order to fix that.
    Hi - I see that first error now. I completely over looked the missing <li> earlier as I was only looking for a missing <ul> tag. I know why that error pops up...just where I'm not finished with that section of the site.

    Please excuse my ignorance, but I know zero PHP and don't know what you're talking about when you say put the URL string trough htmlspecialchars() before outputting it....

    Thanks
    Deron
    Deron Sizemore
    ----------
    My Sites: LogoGala | Golf Ledger (coming soon)
    Twitter: Deron Sizemore

  4. #4
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I'm surprised your CMS doesn't do that for you... unless you're just copying and pasting those links into a template. I you can control what the PHP is doing with your links, then before the anchor's HTML is outputted by PHP (via an echo or print() statement most likely), take your URL and do this:
    PHP Code:
    $newurl htmlspecialchars($url); 
    where $url is the original URL with the unescaped ampersands

    Either that or do it manually, but if the links are coming from somewhere else, you're going to have to find a way to automate it.

  5. #5
    Web Design Addict
    Join Date
    Mar 2004
    Posts
    2,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes I was just copy and pasting the link code into my template.

    I actually fixed it as I found a different affiliate link to use...one without all of the bloat and special characters.
    Deron Sizemore
    ----------
    My Sites: LogoGala | Golf Ledger (coming soon)
    Twitter: Deron Sizemore


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •