Error when assembling a link

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matthew White

    Error when assembling a link

    Hi,

    I am assembling navigation links for an online article. The code works
    fine for WIN IE 6 users, but not for NN4, or Mac IE5 users. When it
    works, the resulting link looks like this:



    On the machines with trouble, we get this:

    /pr3/\\\\www.mydomain.com\\pr3\\article2.php

    (Sorry for the dummy URL - I can't share the page yet)

    As you can see, the link is now relative, and the slashes are working
    out poorly. Is there a rule or technique I am missing that could make
    this calculation work for the older browsers?

    Thanks,

    Matt


    The relevant code is:

    $page_num=1;
    $page_location= 'http:\\\www.my domain.com\\pr3 \\';


    $prev_page=$pag e_num-1;
    $next_page=$pag e_num+1;
    if ($prev_page == 0) {
    $prev_page_link =NULL;
    $prev_page_labe l=NULL;
    }
    else {
    $prev_page_link = $page_location .'article'. $prev_page . '.php';
    $prev_page_labe l = '< ' . $prev_page;
    }
    if ($next_page > $num_pages) {
    $next_page_link =NULL;
    $next_page_labe l=NULL;
    }
    else {
    $next_page_link = $page_location .'article'. $next_page . '.php';
    $next_page_labe l =$next_page . ' >';

    echo ('<td width="380px" align="right">< h3> Article
    Navigation:</h3></td>');
    echo ("<td align=\"left\"> <h3><a
    href=\"$prev_pa ge_link\">$prev _page_label</a> $nbsp $page_num $nbsp <a
    href =\"$next_page_l ink\">$next_pag e_label</a></h3></td></tr>");
  • sk

    #2
    Re: Error when assembling a link

    Why are you using backslashes in $page_location? See the second line of
    your script. http:// is valid. http:\\ is not. Windows IE is forgiving
    about this sometimes. Other browsers and the HTTP spec are not.

    Matthew White wrote:[color=blue]
    > I am assembling navigation links for an online article. The code works
    > fine for WIN IE 6 users, but not for NN4, or Mac IE5 users. When it
    > works, the resulting link looks like this:
    >
    > http://www.mydomain.com/pr3/article2.php
    >
    > On the machines with trouble, we get this:
    >
    > /pr3/\\\\www.mydomain.com\\pr3\\article2.php[/color]

    .....
    [color=blue]
    > The relevant code is:
    >
    > $page_num=1;
    > $page_location= 'http:\\\www.my domain.com\\pr3 \\';[/color]

    Comment

    Working...