Web Analytics Made Easy -
StatCounter Just have to encase href's in quotes, probably simple - CodingForum

Announcement

Collapse
No announcement yet.

Just have to encase href's in quotes, probably simple

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Just have to encase href's in quotes, probably simple

    Hello,

    This page: http://www.bartlett-family.net/chris...eauty&search=1

    The anchors for the links of additional page results at the bottom need to be encased in quotation marks.

    The php code generating these links is
    PHP Code:
    print "<a href=\"".$_SERVER['PHP_SELF']."?query=".addmarks($query)."&amp;start=".$prev."&amp;search=1&amp;results=$results_per_page&amp;type=$searchtype\">".$sph_messages["Previous"]."</a> "
            
    $firstpage $start $links_to_next;
            if (
    $firstpage 1$firstpage 1;
            
    $lastpage $start $links_to_next;
            if (
    $lastpage $pages$lastpage $pages;

            for (
    $x=$firstpage$x<=$lastpage$x++)
                if (
    $x<>$start)    {
                    print 
    "<a href=".$_SERVER['PHP_SELF']."?query=".addmarks($query)."&start=$x&search=1&results=$results_per_page&type=$searchtype>$x</a> ";
                }
            else
                print 
    "<b>$x </b>";
            if (
    $next <= $pages)
                print 
    "<a href=\"".$_SERVER['PHP_SELF']."?query=".addmarks($query)."&amp;start=".$next."&amp;search=1&amp;results=$results_per_page&amp;type=$searchtype\">".$sph_messages["Next"]."</a>";
        } 
    Bottom line is that if you look at the source, on line 56, you see
    Code:
    <a href=/
    which needs to be
    Code:
    <a href="/
    I hope I'm explaining this right... LOL. I've played with it, but since I know nothing about php, I always end up getting parse errors or something else regarding quotes wheere they shouldn't be. Erf...

    Any help, please?

    Chris
    My Site | My Blog

  • #2
    Code:
    if ($x<>$start)    {
                    print "<a href=[color=red][b]\[/b][/color]".$_SERVER['PHP_SELF']."?query=".addmarks($query)."&start=$x&search=1&results=$results_per_page&type=$searchtype[color=red][b]\"[/b][/color]>$x</a> ";
                }
    Forget style. Code to semantics. Seperate style from structure, and structure from behaviour.
    I code to specs, and test only in Firefox (unless stated otherwise).

    Comment


    • #3
      To avoid things like this use the single quote around string? That way you can have '<a href="blah.com">' without any escape characters.

      Comment

      Working...
      X