Jump to content

dreamwest

Members
  • Posts

    1,223
  • Joined

  • Last visited

    Never

Posts posted by dreamwest

  1. The actual HTML to generate a menu is so minimal, there isn't even really any reason to cache it in the browser. It's a very, very small portion of the page. If you even have one tiny image on your page, it will take up significantly more data than any menu on any website ever (assuming your menu doesn't use images! But even if it does, you should just cache the images, not the HTML).

     

    Im just obsessed with instant page loading, ive had some good success with preprocessors and compression. The page loading time has been reduced to (Time: 0.076079) front end, but thats with menus, if i can store the template in the servers memory im assuming that would so the trick.

     

    Anyways i havent given up..

  2. Using JavaScript to generate a menu is an awful idea. How will crawlers navigate your site?

     

     

    What i really wanted to do was store part of the page such as the menu in memory. Im just not sure how to go about it without using a 3rd party app like eaccelerator -  theres gotta be some way to do it..

  3. I wanted to include a static menu, but istead have it cached by an external js file. Is this a good idea, are there any security flaws in doing this??

     

    js file

    function show_menu(){
    document.write("menu menu menu menu");
    return;
    }

     

    and the menu.html

    <script  type="text/javascript" src="menu.js"></script>
    <body onload='show_menu();'>

  4. Actually i thought that worked but the problem is $title in the new array get the

     

    print_r($title)

    	SimpleXMLElement Object
    (
        [0] => Rules of Engagement - Play Ball Extended Preview - Season 5 - Episode 12
    )}

     

    print_r($arr2);

    Array
    (
        [0] => Array
            (
                [vid] => SimpleXMLElement Object
                    (
                        [0] => cb-uA4QHmpDxYdpgW1jPwiYsUwjBViwlinS
                    )
    
                [title] => SimpleXMLElement Object
                    (
                        [0] => Rules of Engagement - Play Ball Extended Preview - Season 5 - Episode 12
                    )
    
                [site_id] => 10
                [time] => 456
            )
    
        [1] => Array
            (
                [vid] => SimpleXMLElement Object
                    (
                        [0] => cb-pOEUN4deIJ2cc_22ZjFCaCIcgimN6D2A
                    )
    
                [title] => SimpleXMLElement Object
                    (
                        [0] => David Letterman - Matt Damon: Tongue-Tied - Season 18 - Episode 3415
                    )
    
                [site_id] => 10
                [time] => 456
            )
    )

     

     

  5.  

    Im trying to parse this xml but i can get it to output a simple string, can someone see what im doing wrong??

     

    $str = "<channel><item>
    		<id>cb-uA4QHmpDxYdpgW1jPwiYsUwjBViwlinS</id>
    		<title>Rules of Engagement - Play Ball Extended Preview - Season 5 - Episode 12</title>
    </item>
    		</channel>";
    
    
    $n_data = new SimpleXmlElement($str, LIBXML_NOCDATA);
    		foreach ($n_data->channel->item as $d) {
    		$vid = $d->id;
    		$title = $d->title;
    
    		 print_r($d->title); //testing
    		 die(); //testing
    		 $arr2[] = array('vid' => $vid, 'title' => $title, 'site_id' => 10 ,'time' => 456);
    		}

     

    The print_r() returns

    SimpleXMLElement Object
    (
        [0] => Rules of Engagement - Play Ball Extended Preview - Season 5 - Episode 12
    )

     

    If i simply echo $d->title it returns a string, but i need to reapply $d->title to another array as shown above

  6. Ive been trying to get this email attachment to work but I think one of the headers is wrong. It wont attach the file

     

     

    $address = "mail@site.com";
    $subject = "Test HTML Message";
    $hash = md5(rand().time());
    $headers .= "From: yourname <you@youremail.com>\r\nReply-To:  noreply@youremail.com";
    $headers .= "\nMIME-Version: 1.0\r\nContent-Type: multipart/mixed; boundary=\"bound-{$hash}\" ";
    
    $file = "http://www.site.com/images/funny.jpg";
    $attachment = chunk_split(base64_encode(file_get_contents($file)));
    $ext = pathinfo($file, PATHINFO_EXTENSION);
    $file_base = pathinfo($file, PATHINFO_BASENAME);
    
    $body = "
    --bound-{$hash} 
    Content-Type: text/html
    Content-Transfer-Encoding: 7bit
    
    
    <h2>Hello from Wizecho!</h2>
    <p>This is the actual email you will receive with <b>HTML</b> <i>formatting.</i></p>
    
    --bound-{$hash} 
    Content-Type: image/jpeg
    name=\"{$file_base}\" 
    MIME-Version: 1.0
    Content-Transfer-Encoding: base64 
    Content-Disposition: attachment 
    
    {$attachment}
    --bound-{$hash}--
    ";
    
    if(mail($address,$subject,$body,$headers)){
    
      echo "Email Sent";
    
    }else{
    
      echo "Mail not sent";
    
    } 

     

  7. SELECT * FROM `table` WHERE MATCH `title` AGAINST('{$searchterms}' IN BOOLEAN MODE) ORDER BY id asc

     

    You should ALWAYS look to MATCH AGAINST for your queries to start with, if you cant do it with that use other query types

     

    If you have an immense database like me, create an inverted index that way your only searching the word and not the whole document, and its SUPER effective

  8. I have a simple select but it wont return the values i need, maybe someone can tell me why its doing this:

     

    Table 1:

     

                v_id v_word

    70 south

    69 park

    68 brub

    67 brrub

    66 brrrrub!

     

    Table2:

     

                    l_id l_word_id        l_vid_id

    70 70,69,68,67,66 834785

     

    SELECT * FROM  `vid_loc` AS l, vid_words AS v WHERE MATCH v.v_word AGAINST ('south park' IN BOOLEAN MODE) AND v.v_id IN (l_word_id) 
    GROUP BY v.v_id 

     

    This returns:

     

    l_id l_word_id               l_vid_id v_id v_word

    70 70,69,68,67,66 834785 70 south

     

    but this selects the two rows i need:

    SELECT * FROM  `vid_loc` AS l, vid_words AS v WHERE MATCH v.v_word AGAINST ('south park' IN BOOLEAN MODE) AND v.v_id IN (70,69,68,67,66) 
    GROUP BY v.v_id 

     

    This returns:

     

    l_id l_word_id        l_vid_id v_id v_word

    70 70,69,68,67,66 834785 69 park

    70 70,69,68,67,66 834785 70 south

     

     

    So the question is:  IN (l_word_id)  and  IN (70,69,68,67,66) both have the same value but why do they return different results?

     

×
×
  • 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.