Array arguments

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mahhood
    New Member
    • Apr 2010
    • 4

    Array arguments

    Warning: array_unshift() [function.array-unshift]: The first argument should be an array in /home/mash99/public_html/thebestoptions. co.cc/book-store/finstall.php on line 383

    Warning: array_unshift() [function.array-unshift]: The first argument should be an array in /home/mash99/public_html/thebestoptions. co.cc/book-store/finstall.php on line 384

    How could I fix it???
  • chathura86
    New Member
    • May 2007
    • 227

    #2
    The first argument should be an array
    i think this tells you the problem

    any way post your code so we can have a look

    Regards

    Comment

    • mahhood
      New Member
      • Apr 2010
      • 4

      #3
      Originally posted by mahhood
      Warning: array_unshift() [function.array-unshift]: The first argument should be an array in /home/mash99/public_html/thebestoptions. co.cc/book-store/finstall.php on line 383

      Warning: array_unshift() [function.array-unshift]: The first argument should be an array in /home/mash99/public_html/thebestoptions. co.cc/book-store/finstall.php on line 384

      How could I fix it???
      Code:
      array_unshift($robots,$crlf);                                             // prepend a blank separator line...
        array_unshift($robots,'Sitemap: '.$freeburl.'Bookshop_index.xml'.$crlf);  // ...then prepend the sitemap directive
        $robots[]='User-agent: *'.$crlf;
        $robots[]='Disallow: '.$localslash.$localurl.$crlf;
        $robots[]='Allow: '.$localslash.$localurl.'allbooks/allbooks.'.$crlf;
        $robots[]='Allow: '.$localslash.$localurl.$myshop.$crlf;
        $robots[]='Allow: '.$localslash.$localurl.'abechange.php'.$crlf;
        $robots[]='Allow: '.$localslash.$localurl.'abes.php'.$crlf;
        $robots[]='Allow: '.$localslash.$localurl.'book-search.php'.$crlf;
        $robots[]='Allow: '.$localslash.$localurl.'free.php'.$crlf;
        $robots[]='Allow: '.$localslash.$localurl.'holder.php'.$crlf;
        $robots[]='Allow: '.$localslash.$localurl.'search.php'.$crlf;
        $robots[]='Allow: '.$localslash.$localurl.'used-books.php'.$crlf;
        $robots[]='Allow: '.$localslash.$localurl.'Bookshop_index.xml'.$crlf;
        $robots[]='Allow: '.$localslash.$localurl.$freebdirname.'-sitemap'.$crlf;
      Last edited by Dormilich; Apr 23 '10, 10:02 AM. Reason: Please use [code] tags when posting code

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        how do you define $robots?

        Comment

        • mahhood
          New Member
          • Apr 2010
          • 4

          #5
          Originally posted by Dormilich
          how do you define $robots?
          Code:
          //       process:  
            $robots=NULL;
            if ($oldrobots!=NULL)
            {
              $target=$localslash.$localurl;  
              foreach($oldrobots as $line)
              {if (strpos($line,$target)===FALSE && strpos($line,$localslash.'freebie'.$localslash)===FALSE) $robots[]=$line;}      $top=count($robots);
              $top=$top-1;  // convert to 0-based offset
              if (trim($oldrobots[$top])!=NULL) $robots[]=$crlf;  // tag on blank separator line (if extant file)
          Last edited by Atli; Apr 23 '10, 10:19 AM. Reason: Please use [code] tags!

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            $robots is NULL, as long as $oldrobots (and some of its conditions) is NULL. that’s all I can see in the posted code. it may well be that $robots is passing your code without being altered.

            Comment

            Working...