Jump to content

[SOLVED] On click refresh div


deepson2

Recommended Posts

Like I said I would use the lytebox plugin. It supports Iframes. I changed the code to support lytebox which also gets rid of the javascript error and makes the code more efficient. first go to http://www.dolem.com/lytebox/ and download the lytebox files. then put them in the root. now in order for it to work outside of the iframe the iframe must have a name, i put one in there. also, the js file must be included in the file that is called in the iframe and the css file must be in the file that holds the iframe as you can see. then the rel tag is just changed to lytebox. i removed the window.addEvent completely as it is not need and thus removing the js error. everything is now working and without error. so change your code to this and let me know if you have any questions:

 

live.php

<script type="text/javascript" language="javascript" src="lytebox.js"></script>

<div id="Container">
  <h3>Pictures</h3>
  <?php
         ini_set( "display_errors", 0);

         $lines = file("http://search.twitter.com/search?q=+twitpic+OR+pic.gd+OR+yfrog+OR+tweetphoto+%23helloween&rpp=50");
                  $html = join("",$lines);

                  // remove all line breaks
                  $html = str_replace("\n","",$html);
                  // and put in a new line break behind every anchor tag
                  $html = str_replace("</a>","</a>\n",$html);
                  // split the string into single lines
                  $lines = split("\n",$html);
                  // $lines now is an array of lines and each line ends with an anchor tag
                  // for every anchor tag, we now have an entry in $lines
                  for($i=0;$i<count($lines);$i++)
                  {
                     // delete everything in front of the anchor tag
                     $lines[$i] = eregi_replace(".*<a ","<a ",$lines[$i]);
                     // now every line just consists of something like <a ...>...</a>

                     // we extract the link within the href attribut ...
                     eregi("href=[\"']{0,1}([^\"'> ]*)",$lines[$i],$regs);
                     // and put it into the $lines array
                     $lines[$i] = $regs[1];
                     //echo $lines[$i];
                     //echo "<br/>";

                     preg_match_all("/http:\/\/pic.gd\/[a-zA-Z0-9 ]+$/", $lines[$i], $matches);
                     $url=$matches[0][0];
                     //echo $url;

                        if(preg_match('/http:\/\/pic.gd/',$url))
                        {
                           $string=explode('http://pic.gd/',$url);
                           //echo "$string[1]";
                           //echo "<br/>";
                           $commas = ",";
                           $a[]=$string[1];
                        }

                     preg_match_all("/http:\/\/twitpic\.com\/[a-zA-Z0-9 ]+$/", $lines[$i], $match);

                        $s=$match[0][0];

                        if(preg_match('/http:\/\/twitpic\.com/',$s))
                        {
                           $stringb=explode('http://twitpic.com/',$s);
                           $commas = ",";
                           $b[]=$stringb[1];
                        }

                     preg_match_all("/http:\/\/yfrog\.com\/[a-zA-Z0-9 ]+$/", $lines[$i], $matches1);
                     $yurl=$matches1[0][0];

                        if(preg_match('/http:\/\/yfrog\.com/',$yurl))
                        {
                           $ystring=explode('http://yfrog.com/',$yurl);
                           $commas = ",";
                           $c[]=$ystring[1];
                        }

                     preg_match_all("/http:\/\/tweetphoto\.com\/[a-zA-Z0-9 ]+$/", $lines[$i], $matches2);
                     $turl=$matches2[0][0];

                        if(preg_match('/http:\/\/tweetphoto\.com/',$turl))
                        {
                           $tstring=explode('http://tweetphoto.com/',$turl);
                           //echo "$tstring[1]";
                           //echo "<br/>";
                           $commas = ",";
                           $d[]=$tstring[1];
                        }
                     }

                     $stringb1 = implode($b,",");
                     //echo "$string1";
                     $dataContainerb = array();
                     $dataContainerb[] = $stringb1;
                     $arrayb = explode(',', $stringb1);
                     //print_r($arrayb);
                     $resultb = array_unique($arrayb);
                     //print_r($result);
                     foreach($resultb as $strItemb)
                     {

                        ?>
  <a class="bthumbnail" href="http://twitpic.com/show/large/<?=$strItemb;?>.jpg" rel="lytebox[mando]" title=""><img src="http://twitpic.com/show/thumb/<?=$strItemb;?>.jpg" width="150" height="150" alt=" Photos" /></a>
  <?
                     }

                     $string1 = implode($a,",");
                     $dataContainer = array();
                     $dataContainer[] = $string1;
                     $array = explode(',', $string1);
                     //print_r($array);
                     $result = array_unique($array);
                     //print_r($result);
                     foreach($result as $strItem)
                     {
                        ?>
  <a class="bthumbnail" href="http://TweetPhotoAPI.com/api/TPAPI.svc/imagefromurl?size=medium&url=http://pic.gd/<?=$strItem;?>" rel="lytebox[mando]" title=""><img src="http://TweetPhotoAPI.com/api/TPAPI.svc/imagefromurl?size=thumbnail&url=http://pic.gd/<?=$strItem;?>" width="150" height="150" alt="Photos" /></a>
  <?
                     }

                     $stringy1 = implode($c,",");
                     $dataContainery = array();
                     $dataContainery[] = $stringy1;
                     $arrayy = explode(',', $stringy1);
                     $resulty = array_unique($arrayy);
                     foreach($resulty as $strItemy)
                     {
                        ?>
  <a class="bthumbnail" href="http://yfrog.com/<?=$strItemy;?>:iphone" rel="lytebox[mando]" title="""><img src="http://yfrog.com/<?=$strItemy;?>.th.jpg" width="150" height="150" alt=" Photos" /></a>
  <?
                     }

                     $stringt1 = implode($d,",");
                     $dataContainert = array();
                     $dataContainert[] = $stringt1;
                     $arrayt = explode(',', $stringt1);
                     $resultt = array_unique($arrayt);
                     foreach($resultt as $strItemt)
                     {

                        ?>
  <a class="bthumbnail" href="http://TweetPhotoAPI.com/api/TPAPI.svc/imagefromurl?size=medium&url=http://tweetphoto.com/<?=$strItemt;?>" rel="lytebox[mando]" title="""><img src="http://TweetPhotoAPI.com/api/TPAPI.svc/imagefromurl?size=thumbnail&url=http://tweetphoto.com/<?=$strItemt;?>" width="150" height="150" alt=" Photos" /></a>
  <?
                     }?>
</div>
<div class="clear"></div>
<div>
<div class="left">
<?php
                  /**
                   * Set up SimplePie with all default values using shorthand syntax.**
                   */
                  $feed = new SimplePie('http://api.flickr.com/services/feeds/photos_public.gne?id=62773263@N00&album=72157612974776665');
                  $feed->handle_content_type();


                  /**
                   * What sizes should we use?
                   * Choices: square, thumb, small, medium, large.
                   */
                  $thumb = 'square';
                  $full = 'small';
         ?>

 

<html>
<title>Test</title>
<head>
<link rel="stylesheet" href="lytebox.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script>
//change the iframes source
function changeSource(){
$("#myIframe").attr("src","live.php");
}
</script>
</head>
<body>

<a href="javascript:changeSource();" id="refresh"><img src="../images/control_refresh.png" alt="Refresh" border="0" /></a>
<br />
<iframe src="live.php" name="myIframe" id="myIframe" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" width="780" height="500" class="iframe"></iframe> 

</body>
</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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