Jump to content

maxyme

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Posts posted by maxyme

  1. I have a very weird problem. On my website i have a script that takes random pages and displays them on the homepage. It works without a problem on its own but when i have it included in the homepage using

    include('webmaster fav.php');

    i get this error: Warning: Cannot use a scalar value as an array in /mnt/w0210/d28/s25/b02a8bb2/www/webmaster fav.php on line 18

    and this error: Warning: array_unique() [function.array-unique]: The argument should be an array in /mnt/w0210/d28/s25/b02a8bb2/www/webmaster fav.php on line 20

    and this error: Warning: array_unique() [function.array-unique]: The argument should be an array in /mnt/w0210/d28/s25/b02a8bb2/www/webmaster fav.php on line 21

    and this error: Warning: Cannot use a scalar value as an array in /mnt/w0210/d28/s25/b02a8bb2/www/webmaster fav.php on line 23

    I am kindof new to php but i think its a good script and it works without errors when it isn't included on the homepage it works. what could be the problem?

    heres the code:

    <?php 
    $directory = "/mnt/w0210/d28/s25/b02a8bb2/www/data/";
    //the list of pages i want to be random on the site
    
    $directory = (!strstr($directory,"*") || $directory =="./" ) ? $directory."*" : $directory;
    //Checks if the wildcard operator is present, and if not it adds it by default at the end;
    
    $files = glob($directory);
    //Yes, it was that easy to get all the files;
    $size=sizeof($files);
    for($i=0;$i<sizeof($files) ; $i++){
      //Loop through the files and adds to array;
    $fp = fopen($files[$i],"r");
    $contents[$i]=fgets($fp,999);
    fclose($fp);
    }
    for($x=0;$x<15;$x++){
    $numb[$x]=rand(1, sizeof($files));
    } 
    $x=count($numb)-count(array_unique($numb));
    $num = array_unique ($numb); 
    for($q=0;$x<15;$x++){
    $numb[$x]=rand(1, sizeof($files));
    } 
    
    //$imploded = implode(" ", $contents); //get rid of spaces
    //$newcontent=explode("~", $imploded); // sort into chucks so i can display the data.
    for($i=0;$i<15; $i++){
    $number=$num[$i];
    if($contents[$number]==""||$contents[$number]==" "||$contents[$number]==null){
    }
    else{
    echo "<li>";
    $replacedcontent=str_replace(' ', '-',$contents[$number]);
    echo "<br/><a href='games/$replacedcontent'>";
    $newrcontent=str_replace('-', ' ',$replacedcontent);
    echo "<img src='$newrcontent.jpg' border='2'></img>";
    echo "<br/>$newrcontent</a></li>";
    }
    }
    ?>
    

    i copied and pasted it from many sites examples so thats why some comments are weird... but basically it gets all the data files. reads the title and puts them in an array, then chooses some random ones and puts them in with their image so they can be displayed on the homepage.

  2. Also, you have some bad code in your pages. Whn I clicked one of the image links, it opened a new browser window. That window had quite a bit of "lag". I thin notices that IE was taking up 20% of my CPU cycles while that window is sitting idle. The browser should be taking up 0% if the user is not loading a page with the rare exception where you have a script running some type of timer loop.

    Yes i know. There is a script i use to make the boxes below the game rounded and in ie they freeze up. Though in any other browser its fine. And srry for pming u alot.

  3. Thanks for telling me about the firefox 3 problem.

    About the iframes, right now i'm trying to use dynamic web templates for most of the site. Once i finish that i will get rid of the iframe and just use it in the template.

  4. You can't give multiple elements on a page the same ID. You can give them similar names that can be processed programatically. Just create all your divs with a common name, but with a unique number. Such as: "game_1", "game_2", "game_3", etc.

     

    Then you can create a simple loop to hide all the divs (and alternatively unhide one specific div):

     

    Note: to hide ALL divs, pass 'false' to the function. Or pass an index number and all divs will be hidden except the specified div

    function showDiv(selectedIndex)
    {
        var divIndex = 0;
        while (document.getElementById('game_'+divIndex))
        {
            var displayStyle = (divIndex==selectedIndex)?'inline':'none';
            document.getElementById('game_'+divIndex).styke.display = displayStyle;
            divIndex++;
        }
    }

    Ok so your script will automatically find the divs that are named game_1,game_2,game_3,ect. right?

    I also believe in the 7th line after divIndex you meant to type style? instead of styke

    Could you provide me with another function to hide it i don't understand what you meant in the note above the code.

  5. hmm a little gastly maybe remove the virtical scroll for the home menu and replace with a horizontal menu

    Do you  mean the marquee? or the horizontal menu

     

     

    Also if anyone is using a older version of internet explorer the horizontal menu will show its vertical and won't show right. Ugh! its a old version of the css styling i use.

  6. I have a games site and i want to have a javascript code that will hide all of the game images. I will be willing to put every image in its own individual div box if its necessary. I want a script that will hide all of the div boxes. If possible i would like it if i would not have to specify all of the div boxes individually but just name them all the same and have them all hide under the same id.

    If you have any questions just ask me.

    Thanks.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.