cowboysdude
-
Posts
123 -
Joined
-
Last visited
Posts posted by cowboysdude
-
-
Can always break it down and make it easier on yourself
<?php $test_link = "http://www.youtube.com/watch?v=LkjE6FMoBwQ&feature=youtube_gdata"; $new_link = str_replace("&feature=youtube_gdata",'',$test_link); echo "<a href='$new_link'>$new_link</a>"; ?>
Thank you too!! That would have also worked I believe!! You guys rock...
-
$link = '<a rel="lightbox[social]" title="DCC Videos" href="'. (str_replace("&feature=youtube_gdata","", $video['link'])).'">';
THANK YOU!! I will look at it again when my eyes are rested.. but it worked!!! Thank you very much!
-
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!
-
That got it!! OH Thank you so much!!!!!
-
Here's the entire code... because I'm not sure what your question means..
<?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...
-
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!
-
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!
-
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!!
-
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
-
Thank you! I have tried that and instead of showing "$infobox" it just shows ".$infobox." LOL
Not really sure why it's not working I am using the exact same lines in another program and it's working fine...
-
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'); ?>
-
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?
-
Nice catch! But it didn't work.. error checking? Well I'd love to but it's a test server [local] and I have checked the Apache error logs as well as the php and nothing shows....
-
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
-
Thank you!! That worked... wow... very simple and sound reasoning! Many Thanks!
-
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...
-
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!
-
I am trying to run a free chat script and cannot get it to work... perhaps someone could take a look and offer me advice on fixing?
Thanks
-
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...
-
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!!!
-
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!!
-
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 -->
-
Ok got it!! Here it is..
<?php If ($v1=="1") { echo '<button rel="#overlay2">'. $title1.'</button>'; } ?>
Many Thanks for all your help!! I'm marking this one solved!!
-
Ok I got $v1 - 10 set.. NOW what is wrong with the following statement because I am just not seeing it...
<?php If ($v1=="1") { echo '<p><button rel="#overlay1">'. $title1.'</button></p>' } ?>
But this is NOW what's stopping the page from loading.. hummmmm
insert code question..
in PHP Coding Help
Posted
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...
That output shows the HUGE picture....
Here is what I've tried to do ...
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....
Thanks guys!! Again!