Jump to content

cowboysdude

Members
  • Posts

    123
  • Joined

  • Last visited

Posts posted by cowboysdude

  1. I am showing Youtube videos on my site and am pulling the data in from an xml file... However this is the problem I'm having...

     

    When I pull in the video the output is working correctly until you get the image file... it's HUGE...  NOT what I wanted so I set about trying to figure out how to resize the image... I have tried many things but no luck. I don't have access to the google api to change the picture size sooooo... I"m trying to do so within the php I do have..here is what I have...

     

    $videos[$i]['img'] = $matches[0];

     

    That output shows the HUGE picture....

     

    Here is what I've tried to do ...

     

    $videos[$i]['img'] = $matches[0] "width=100px height=100px";

     

     

    That is a no go... it crashes the site and I know it's a quote thing..  I do know that the first example outputs the image... or puts the img in a string to be output according to the video, I understand that.  How do I resize the img to make it smaller?

     

    Here is the entire code for the parsing of the xml file.... 

     

    <head>
    
    <link rel="stylesheet" href="modules/mod_jusertube/css/mediaboxAdvBlack21.css" type="text/css" media="screen" />
    
    <script src="modules/mod_jusertube/js/mootools-more-1.3.js" type="text/javascript"></script> 
    <script src="modules/mod_jusertube/js/mediaboxAdv-1.4.0.js" type="text/javascript"></script>
    <script src="modules/mod_jusertube/js/an7effects-1.5.5.js" type="text/javascript"></script>
    
    </head>
    
    <?php
    /**
    * @Copyright Copyright (C) 2010- Md. Afzal Hossain
    * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
    **/
    
    /*
    This file is part of mod_lcc.
    
        mod_lcc is free software: you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation, either version 3 of the License, or
        (at your option) any later version.
    
        mod_lcc is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
    
        You should have received a copy of the GNU General Public License
        along with mod_lcc.  If not, see <http://www.gnu.org/licenses/>.
    
    */
    // no direct access
    defined('_JEXEC') or die('Restricted access');
    
    class FeedReader
    {
        var $cachetime;
    var $filepath;
    
    
    function __construct($updatefeed = 300){
    	$this->cachetime = $updatefeed;
    	$this->filepath = dirname(__FILE__).DS;
    }
    
    function get_youtube_top($youtubeuser,$totalvid){
            $filename = $this->filepath.'youtube_'.$youtubeuser.'.xml';
            if(is_file($filename)){
                $utime = filemtime($filename);
                $chtime = time() - 60*$this->cachetime;
                if($utime>$chtime) $updated = true;
                else $updated = false;
            }
            else{
                $updated = false;
            }
            if(!$updated){
    	    $link="http://gdata.youtube.com/feeds/base/users/$youtubeuser/uploads?alt=rss";
    	    $ch = curl_init($link);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                curl_setopt($ch, CURLOPT_HEADER, 0);
                $data = curl_exec($ch);
                curl_close($ch);
                if(strlen($data)>100) file_put_contents($filename,$data);
            }
            
            if(is_file($filename)){
                $data = file_get_contents($filename);
            }
            else{
                return false;
            }
    
    	$rss = new SimpleXMLElement($data);
    	$i = 0;
            $videos = array();
    	foreach($rss->channel->item as $item){
                //$guid_split = explode('/',$item->guid);
                //$videos[$i]['id'] = $guid_split[6];
                $videos[$i]['title'] = (string) $item->title;
                $videos[$i]['link'] = (string) $item->link;
                //$videos[$i]['embed'] = '<object width="100" height="125"><param name="movie" value="http://www.youtube.com/watch/'.$guid_split[6].'"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><embed src="http://www.youtube.com/v/'.$guid_split[6].'" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="385"></object>';
                
                $description = (string) $item->description;
                $matches = array();
                preg_match("/<img[^<>]+>/",$description,$matches);
                $videos[$i]['img'] = $matches[0];
    		$i++;
    		if($i>=$totalvid) break;
    	}
    	return $videos;
    }
        
    }
    

     

    Thanks guys!! Again!

  2. Honestly I've been staring at this for 3 hours LOL and I just can't get it to work..  A little help please would be so awesome.

     

    $link = '<a rel="lightbox[social]" title="DCC Videos" href="echo (str_replace("&feature=youtube_gdata","", $video['link']))">';

     

    To be more precise this is actually the part that's not working...

     

    href="echo (str_replace("&feature=youtube_gdata","", $video['link']))">';

     

    That line right there is my problem... whew... thrown myself a little I think...

     

    Thank you for the help!

  3. Here's the entire code...  because I'm not sure what your question means..  :D

     

    <?php 
    //this array contains sports and their URLs 
    $sports = array( 
    "NFL" => "http://sports.espn.go.com/nfl/bottomline/scores"); 
    $results = array(); 
    foreach ( $sports as $sport => $url ) { 
      //get the page pointed to by $url 
        $page = file_get_contents($url); 
        //grab all variables out of the page 
        preg_match_all("/&([^=]+)=([^&]+)/", urldecode($page), $foo); 
        //loop through all the variables on the page 
        foreach ( $foo[1] as $key => $value ) { 
          //debug output, you can delete this next line 
          //echo "{$value} = {$foo[2][$key]}\t<br />\n"; 
        //this chain of IF/elseif statements is used to determine which pattern to use 
        //to strip out the correct data, since each sport seems to have its own format 
        //for the variables you'd "want" 
        if ( $sport == "NFL" && preg_match("/s_left\d+/", $value) ) { 
          $results[$sport][] = $foo[2][$key]; 
        }  
        }   
         
    } 
    
    //calculate the sport with the most number of rows 
    $limit = 0; 
    foreach ( $results as $countMe ) { 
      $limit = max($limit, count($countMe)); 
    } 
    
    //spit out the table with the right headers 
    echo "<div id='wrap'><div id='header'>" . implode("</div>", array_keys($sports)) . ; 
    //loop until you reach the max number of rows, printing out all the table rows you want 
    for ( $p = 0; $p < $limit; $p++ ) { 
      echo "<tr>"; 
      foreach ( array_keys($sports) as $sport ) { 
        echo "<td>{$results[$sport][$p]}</td>"; 
      } 
      echo "</tr>"; 
    } 
    //kill the table 
    echo "</table></div>"; 

     

     

    Line 75 is the output... If there's a better way to do it I"m all ears LOL  I just find it hard to believe I can't get that line to work...

     

     

  4. echo "<div id='wrap'><div id='header'>" . implode("</div>", array_keys($sports)) . ; 

     

    I get the following error:

     

    Parse error: syntax error, unexpected ';' in /hermes/bosweb/xxxxx/xxx/xxxxxxxxxxxxxxxx/xxxxx/xxx_xxxx/xxx_xxxxxx.php on line 75

     

    The above line is 75.  I have changed the quotes using ' ' or " " and no matter what I do I continue to get errors.. where am I going wrong here? 

     

    Thanks!

  5. This is what I am using and it returns the entire schedule for the whole league...

     

    if ($display == "schedule") {
    
    $schedule = $ffn->getSchedule();
    
    echo '<h4>Season Schedule</h4>';
    echo '<p>Season: ', $schedule->Season, '</p>';
    
    foreach($schedule->Games AS $game) {
    echo '<p>';
    echo 'Week: ', $game->Week, ' ', $game->AwayTeam, ' at ', $game->HomeTeam, ' on ', date("M j, Y", strtotime($game->GameDate)), ' at ', $game->GameTime, ' ', $schedule->Timezone;
    echo '</p>';
    }
    }

     

    BUT what I would like to do is search the info and only post info for one team...

     

    I have tried this...

     

    if ($display == "schedule") {
    
    $schedule = $ffn->getSchedule();
    
    echo '<h4>Season Schedule</h4>';
    echo '<p>Season: ', $schedule->Season, '</p>';
    
    foreach($schedule->Games AS $game)
    if (AwayTeam == 'DAL") {
    echo '<p>';
    echo 'Week: ', $game->Week, ' ', $game->AwayTeam, ' at ', $game->HomeTeam, ' on ', date("M j, Y", strtotime($game->GameDate)), ' at ', $game->GameTime, ' ', $schedule->Timezone;
    echo '</p>';
    }
    }
    ELSE IF (HomeTeam == 'DAL')
    if ($display == "schedule") {
    
    $schedule = $ffn->getSchedule();
    
    echo '<h4>Season Schedule</h4>';
    echo '<p>Season: ', $schedule->Season, '</p>';
    
    foreach($schedule->Games AS $game) {
    echo '<p>';
    echo 'Week: ', $game->Week, ' ', $game->AwayTeam, ' at ', $game->HomeTeam, ' on ', date("M j, Y", strtotime($game->GameDate)), ' at ', $game->GameTime, ' ', $schedule->Timezone;
    echo '</p>';
    }
    }
    
    Else 
    echo "No Games Scheduled"

     

    Problem is it's not working... how can I just pull the info for DAL and only display that info.  The info is coming from an XML file...

     

    Thanks in Advance!

  6. currently I am using this:

     

    if ($display == "schedule") {
    
    $schedule = $ffn->getSchedule();
    
    echo '<h4>Season Schedule</h4>';
    echo '<p>Season: ', $schedule->Season, '</p>';
    
    foreach($schedule->Games AS $game) {
    echo '<p>';
    echo 'Week: ', $game->Week, ' ', $game->AwayTeam, ' at ', $game->HomeTeam, ' on ', date("M j, Y", strtotime($game->GameDate)), ' at ', $game->GameTime, ' ', $schedule->Timezone;
    echo '</p>';
    }
    }
    

     

    It's working great... the only problem I want to be able for users to pick a week then have it display that weeks matchups...

     

    Any help would be greatly appreciated!!

     

     

  7. Well I figured out the problem and it displays but doesn't rotate throw the info.txt file..LOL

     

    THe problem was I had a php tag in the beginning...terminated it and one at the end terminated. I was trying to put one in the middle and that just threw errors..

     

    like this..

     

    <?php
    If ($nticker=="0") {
      ?>
    
    
        <div id="NewsTicker">
        <div id="controller">
        <div id="stop_scroll_cont"><a id="stop_scroll"><img src="modules/mod_game/img/stop.png" width="14" height="14" border="0" align="absmiddle" /></a> Stop news scroll</div>
        <div id="play_scroll_cont"><a id="play_scroll"><img src="modules/mod_game/img/play.png" width="14" height="14" border="0" align="absmiddle"/></a> Play news scroll</div>
        </div>
    
    <div id="NewsVertical">
    <ul id="TickerVertical">
    <?php
    $lines = file('info.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    foreach($lines as $line);
    list($title, $infobox) = explode('-', $line);
    echo '<li><h3>'.$title.'</h3><span><p>'.$infobox.'</span></li>';
    ?>
    </ul></div></div>
    
    
    <?php
      }
        include ('tmpl/in.php');
    ?>

     

    If I take out the php tag and the ?> from the echo $title and $infobox section it doesn't error but it just shows the $title and $infobox as text, not a variable.

     

    I did do this...

     

    <?php
    If ($nticker=="0") {  
       $lines = file('modules/mod_game/info.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    foreach($lines as $line);
    list($title, $infobox) = explode('-', $line);
        echo '<div id="NewsTicker">';
        echo '<div id="controller">';
    echo '<div id="stop_scroll_cont"><a id="stop_scroll"><img src="modules/mod_game/img/stop.png" width="14" height="14" border="0" align="absmiddle" /></a> Stop news scroll</div>';
        echo '<div id="play_scroll_cont"><a id="play_scroll"><img src="modules/mod_game/img/play.png" width="14" height="14" border="0" align="absmiddle"/></a> Play news scroll</div>';
        echo '</div>';
    
    echo '<div id="NewsVertical">';
    echo '<ul id="TickerVertical">';
    
    
    echo '<li><h3>'.$title.'</h3><span><p>'.$infobox.'</span></li>';
    
    echo '</ul></div></div>';
    
    }
        include ('tmpl/in.php');
    echo '<script language="javascript" type="text/javascript" src="/modules/mod_game/js/newsticker.js"></script>';
    ?>

     

    and now it shows the text from the file but only 1 line... so if I have mulitple lines it only shows the last line...

    If I can figure that out I'd be gold...  I am probably making this way harder than it has to be but I've been looking at this for 4 days and my mind is probably confused and scrambled... LOL

  8. This is what I have and so far the box shows up but it literally is showing "$Title" and "$infobox" in the box ... and not what's in the info.txt file... any ideas?

     

    <?php
    If ($nticker=="0") {
      ?>
    
    
        <div id="NewsTicker">
        <div id="controller">
        <div id="stop_scroll_cont"><a id="stop_scroll"><img src="modules/mod_game/img/stop.png" width="14" height="14" border="0" align="absmiddle" /></a> Stop news scroll</div>
        <div id="play_scroll_cont"><a id="play_scroll"><img src="modules/mod_game/img/play.png" width="14" height="14" border="0" align="absmiddle"/></a> Play news scroll</div>
        </div>
    
    <div id="NewsVertical">
    <ul id="TickerVertical">
    <?
    $lines = file('modules/mod_game/info.txt');
    foreach($lines as $line);
    list($title, $infobox) = explode('-', $line);
    echo "<li><h3>" $title "</h3><span><p>" $infobox "</span></li>";
    
    </ul></div></div>
    
    
    <?php
      }
        include ('tmpl/in.php');
    ?>

  9. Awesome..Thank you!!  I did find the problem without that though.. my own stupid mistake LOL

     

    I have open php tags in the beginning and the end... it looks like this:

     

    <?php
    If ($nticker=="0") {
      ?>
        <div id="NewsTicker">
        <div id="controller">
        <div id="stop_scroll_cont"><a id="stop_scroll"><img src="http://localhost/modules/mod_game/img/stop.png" width="14" height="14" border="0" align="absmiddle" /></a> Stop news scroll</div>
        <div id="play_scroll_cont"><a id="play_scroll"><img src="http://localhost/modules/mod_game/img/play.png" width="14" height="14" border="0" align="absmiddle"/></a> Play news scroll</div>
        </div>
    
    <div id="NewsVertical">
         <ul id="TickerVertical">
    <li><h3><? echo $title ?></h3>
    <span><p><? echo $infobox ?></span></li>
          </ul>
        </div>
    </div>
    
    
    <script language="javascript" type="text/javascript" src="/modules/mod_game/js/newsticker.js"></script>
    <?php
      }
    ?>
    

     

    That was to escape the PHP to show HTML.. NOW the problem I have to figure out is how to stuff the following in there too to make it all work...

     

    $lines = file('modules/mod_game/info.txt');
    foreach($lines as $line);
    
    list($title, $infobox) = explode('-', $line);

     

    Any ideas where I can put that? 

  10. I have an app on my site and it currently displays 3 items in a 'news ticker' that rotates.... This is what I currently have..

     

    <div id="NewsVertical">
         <ul id="TickerVertical">
    <li>
          <h3><?php echo $title ?></h3>
       <span><p><?php echo $infobox ?></span>
    </li>
    <li>
       <h3><?php echo $title1 ?></h3>
       <span><?php echo $infobox1 ?></span>
    </li>
    <li>
       <h3><?php echo $title2 ?></h3>
       <span><?php echo $infobox2 ?></span>
    </li>
          </ul>
        </div>
    </div>

     

    and it works great but this is what I'm trying to do to so I can take off the 3 limitation that I currently have...

     

    <div id="NewsVertical">
         <ul id="TickerVertical">
    <?php
    $lines = file('http://localhost/modules/mod_game/info.dcc', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    foreach($lines as $n_line)
    {
        list($title, $infobox) = explode('-', $n_line);
    echo '<h3>'. $title .'</h3><br /><p>'.$infobox.;
    }
    ?>

     

    However now it just crashes and will not display anything.. What have I missed here?

     

    Thank you in advance!!

     

    John

  11. I appreciate the help!! But I'm not quite sure what you mean so this is what I did..

     

    changed

    <? echo $infobox?>

    to

    <?php echo $infobox;?>

     

    But it shows nothing...  at least it's not showing me the "echo $infobox' anymore..LOL

     

    Here is what I'm seeing in the html source...

     

    <div id="NewsVertical">
      <ul id="TickerVertical">
    <li>
       	<h3><?php echo $title;?></h3>
    <span><p><?php echo $infobox;?></span>
    </li>
    <li>
    <h3><?php echo $title1;?></h3>
    <span><?php echo $infobox1;?></span>
    </li>
    
    <li>
    <h3><?php echo $title2;?></h3>
    <span><?php echo $infobox2;?></span>
    </li>
    	</ul>
        </div>
    </div>

     

    Not quite sure why it won't work but hey this is how we learn...  ;)

  12. This is what I have so far....  what I'm trying to do is if a variable is marked '0' then the display is off... '1' it's on...that part is working fine... it's the part within the part that's kicking my butt..LOL 

     

    Here it is:

     

    <?php
    If ($nticker=="0") {
    echo '
    <div id="NewsTicker">
        <div id="controller">
        <div id="stop_scroll_cont"><a id="stop_scroll"><img src="http://localhost/modules/mod_game/img/stop.png" width="14" height="14" border="0" align="absmiddle" /></a> Stop news scroll</div>
        <div id="play_scroll_cont"><a id="play_scroll"><img src="http://localhost/modules/mod_game/img/play.png" width="14" height="14" border="0" align="absmiddle"/></a> Play news scroll</div>
        </div>
    <div id="NewsVertical">
      <ul id="TickerVertical">
    <li>
       	<h3><?echo $title?></h3>
    <span><p><?echo $infobox?></span>
    </li>
    <li>
    <h3><?php echo $title1?></h3>
    <span><?php echo $infobox1?></span>
    </li>
    <li>
    <h3><?php echo $title2?></h3>
    <span><?php echo $infobox2?></span>
    </li>
    	</ul>
        </div>
    </div>';
    }
    ?>

     

    It's the echo infoboxes that aren't working for me.. it just echos 'echo $infobox_' which is what I'm telling it to do... Problem is I'd like it to echo the information stored in the variables not the variables themselves.

     

    Suggestions?

     

    Many Thanks!  :D

  13. You're not defining $n_time within your list: list($n_id, $n_vid, $n_pic, $n_title) = explode('-', $n_line);

     

    Add it if you know how, or show us the structure of $n_line.

     

    It's above as this..

     

    list($n_id, $n_vid, $n_pic, $n_title) = explode('-', $n_line);

     

    except I would have added this...

     

    list($n_id, $n_vid, $n_pic, $n_title, $n_time) = explode('-', $n_line);

    and when I do that is when I get the offset error..

     

    I pasted the entire code above... that is all that is between the <? and ?> lines...

  14. This is what I"m using and it works great until I add $n_time to the list variable set then I get this error...

     

    "Undefined offset: etc..etc.." 

     

    Take out the $n_time variable and the error goes away.. suggestions? 

     

     

    $lines = file('modules/mod_norven/edit/files.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    foreach($lines as $n_line)
    {
        list($n_id, $n_vid, $n_pic, $n_title) = explode('-', $n_line);
    echo '<li><a href="'.$n_url.'/'.$n_path.'/'.$n_vid.'" id="mb'. $n_id.'" class="mb" ><IMG class=Tips4 title="'.$n_time.'::'.$n_title.'" src="'.$n_url.'/modules/mod_norven/images/vidimg/'. $n_pic .'" border="0" width="60" Height="60" ></a></li>';
    }
    ?>

     

    Thanks in advance!!!

  15. if the HTML is showing up fine, but the browser isn't doing what it should when you click on the link, that's a client-side issue and is not PHP's fault. once the HTML output is finished, PHP's job is done.

     

    the problem is that you haven't defined an anchor to match the link you echo above. nowhere do you use <a name="overlay"> to define where the #overlay link should go.

     

    NOW that is very helpful!!! Thank you!!

  16. I have the following code... it works fine [when I view the html source] it's listing everything correctly but when I click on the link to open an overlay for a video it does nothing but sit there...

     

    Not sure what I've missed or what is wrong but can someone give me an idea or point me in the right direction please?

     

    <?php
    $lines = file('modules/mod_test/files.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    foreach($lines as $line)
    {
        list($ol, $pic, $vid, $title) = explode('-', $line);
    echo '<a href="#overlay" rel="#overlay'. $ol.'"><img src="/modules/mod_test/img/'. $pic .'" alt="picture here" /></a> '. $title.' <br />';
    }
    ?>
    
    <!-- overlays for videos -->
    
    <?php
    $lines = file('modules/mod_test/files.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    foreach($lines as $line)
    {
        list($ol, $pic, $vid, $title) = explode('-', $line);
        echo '<div class="overlay" id="overlay' .$ol .'">';
        echo "<a href='$url/clips/$vid'>";
        echo "</div><br />";
    } 
    ?>
    
    
    <!-- overlays for videos -->

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