need quick look in rewrite php code

Discussion in 'PHP' started by Goonline, Aug 22, 2006.

  1. #1
    I add this part to my rewrite function but i am getting an error

    $categories_string .= '<a href="';

    $cPath_new = "n=" . preg_replace("/[^a-zA-Z0-9]+/", "_", $tree[$counter]['name']);
    if ($tree[$counter]['parent'] ']== 0) {
    $cPath_new .= '&cP=' . $counter;
    } else {
    $cPath_new .= '&cP=' . $tree[$counter]['path'];
    }

    $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new, 'NONSSL', true, true) . '">';

    What do need to do

    The Full details are on this url

    http://www.jjwdesign.com/seo_oscommerce_urls.html

    Thank you
    Good day
     
    Goonline, Aug 22, 2006 IP
  2. klown

    klown Peon

    Messages:
    2,093
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #2
    whats the error, and just to make sure that last line isnt supposed to call a command called temp_href_link is it?
     
    klown, Aug 22, 2006 IP
  3. Goonline

    Goonline Well-Known Member

    Messages:
    239
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    130
    #3
    the error that i am getting is painted BOLD

    if ($tree[$counter]['parent'] ']== 0) {
     
    Goonline, Aug 22, 2006 IP
  4. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #4
    What's with that last single quote and close bracket?

    Shouldn't it be:
    if ($tree[$counter]['parent']== 0) {

    But tell me... what PHP errors were coming up? That code you had was bound to error and so I have to ask: do you have error reporting turned off? If so, why?

    When it comes to finding out why something doesn't work, I find that:
    a) the error message generally tells me what the problem is; but
    b) if I can't work it out, it really, really helps other people if I copy that message in to my thread.

    Anyway, hope that helps.
     
    TwistMyArm, Aug 22, 2006 IP
  5. Goonline

    Goonline Well-Known Member

    Messages:
    239
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    130
    #5
    I try that still dosent work

    The error is

    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING
    /htdocs/osc/includes/boxes/categories.php on line 24


    Waiting for your updates
     
    Goonline, Aug 22, 2006 IP
  6. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Well, if line 24 is the one that you highlighted, I can't see any other problems with it.

    That error message is exactly what I would expect for that kind of error...

    I know this may sound dumb, but make sure the change has been made, then wait a little while. I've found that some hosts cache 'strangely', so maybe it's actually your old script still running...
     
    TwistMyArm, Aug 22, 2006 IP
  7. [*-AnOnYmOuS-*]

    [*-AnOnYmOuS-*] Active Member

    Messages:
    253
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    58
    #7
    Your problem is kinda so obvious :D . The error is in the parsing of the [counter]['parent']'] . I don't believe the '] should be there. '] I assume , is the error. If not, please try posting in this page's whole code so we can know wth line 24 is :D .
     
    [*-AnOnYmOuS-*], Aug 22, 2006 IP