Jump to content

jdubwelch

Members
  • Posts

    85
  • Joined

  • Last visited

    Never

Everything posted by jdubwelch

  1. I'm making a lot of "admin" pages for websites i've been doing lately for clients to add their own news, etc. I want to make it easier for them to add links, pictures, and format the text they are adding to the text field. I've tried googling and searching sites for tutorials or scripts to do this but I've come up with nothing so far. I want to make something similar to what phpfreaks has here but way more basic. Probably just with bold, italic, and add link for starters. So what is this called? What should I search for? If you know of any tutorials, or scripts can you point me to them?
  2. I've got a script that reads RSS feeds and shows them. Some show the xml file, some don't. I'm totally stumped as to why it doesn't. At first I thought it wouldn't reed RSS version 2.0 files, but I tried different ones and some worked. So that wasn't it. This is the xml file i'm trying to read in. If I save this file on my own server link to it directly it WORKS! However, if i link to the actual file on whatever server it's on, nothing shows up. I know i have the right link, i copied it right from my RSS feed program and if i paste it into my web browser it brings up the feed. The link to the actual xml file is: http://rgweb-c.registerguard.com/blogs/index.php/ducksbkn/rss_2.0/ This is the xml file: <?xml version="1.0" encoding="utf-8"?> <rss version="2.0" xmlns:ng="http://newsgator.com/schema/extensions" xmlns:wfw="http://wellformedweb.org/CommentAPI/"> <channel> <title>Duck Men's Basketball with Bob Clark</title> <link>http://rgweb-c.registerguard.com/blogs/index.php/ducksbkn</link> <copyright>Copyright retained by original author, refer to http://rgweb-c.registerguard.com/blogs/index.php/ducksbkn/rss_2.0/ for further information</copyright><description /> <webMaster>support@newsgator.com</webMaster> <lastBuildDate>2008-02-02T21:53:31</lastBuildDate><image><url /> <title>Duck Men's Basketball with Bob Clark</title> <link>http://rgweb-c.registerguard.com/blogs/index.php/ducksbkn</link></image> <ng:id>1790546</ng:id><ttl>60</ttl> <ng:token>MDIyMDA4LTAyLTAyVDIxOjUzOjMxLjEzMCA0MjkyMTI3NDIz</ng:token> <item> <title>Moving up the lists in Civil War</title> <link>http://rgweb-c.registerguard.com/blogs/index.php/ducksbkn/commentsmoving_up_the_lists_in_civil_war/</link> <description><p>OK, who breaks their skid? </p> <p> Oregon has lost four in a row, Oregon State it&#8217;s last 10 games. </p></description> <guid isPermaLink="false">tag:newsgator.com,2006:Feed.aspx/1790546/4292127318</guid> <pubDate>Sun, 03 Feb 2008 01:23:43 GMT</pubDate> <ng:modifiedDate>Sat, 02 Feb 2008 18:23:44 GMT</ng:modifiedDate> <ng:postId>4292127318</ng:postId> <ng:read>False</ng:read> <author>bclark@guardnet.com</author> <ng:avgRating>0.000000</ng:avgRating> <ng:clipped>False</ng:clipped> </item> <item> <title>Oregon pulls away from Beavers, 79-63</title> <link>http://rgweb-c.registerguard.com/blogs/index.php/ducksbkn/commentsoregon_pulls_away_from_beavers_79_63/</link> <description><p>Oregon went on a three-point spree to break away from a one-point lead as the Ducks continued their mastery over Oregon State at McArthur Court with a 79-63 victory Saturday. </p> <p> In winning the Civil War at home for the 15th consecutive year, the Ducks (13-8, 4-5 in the Pac-10) also halted their own four-game losing streak. The Beavers (6-15, 0-9) lost their 10th consecutive game and reached the midpoint of their Pac-10 schedule still winless. </p></description> <guid isPermaLink="false">tag:newsgator.com,2006:Feed.aspx/1790546/4292127423</guid> <pubDate>Sun, 03 Feb 2008 01:23:43 GMT</pubDate> <ng:modifiedDate>Sat, 02 Feb 2008 18:23:44 GMT</ng:modifiedDate> <ng:postId>4292127423</ng:postId> <ng:read>True</ng:read> <author>bclark@guardnet.com</author> <ng:avgRating>0.000000</ng:avgRating> <ng:clipped>False</ng:clipped> </item> </channel> </rss> Here's my php code do display xml RSS Feeds: <?php function readXML($file){ // Read in XML from URL into variable $xml $filePointer = fopen($file,"r") or die("Could not connect to the rss file"); while(!feof($filePointer)){ $xml .= fread($filePointer,1024); } fclose($filePointer); return $xml; } function startTag($parser,$tag,$attributes){ // Process XML Opening Tags global $rssBlockLocation; global $rssCurrentTag; if($tag == "CHANNEL"){ $rssBlockLocation = "CHANNEL"; } elseif ($tag == "ITEM") { $rssBlockLocation = "ITEM"; } $rssCurrentTag = $tag; } function endTag($parser,$tag){ // Process XML Closing Tags global $rssBlockLocation; global $rssItemArray; global $rssTempItem; if($rssBlockLocation == "ITEM" && $tag == "ITEM"){ $rssItemArray[] = $rssTempItem; $rssTempItem = ""; } } function characterData($parser,$characterData){ // Process XML Character Data global $rssBlockLocation; global $rssCurrentTag; global $rssChannelArray; global $rssTempItem; if($rssCurrentTag == "TITLE" || $rssCurrentTag == "LINK" || $rssCurrentTag == "DESCRIPTION"){ if($rssBlockLocation == "CHANNEL"){ $rssChannelArray[$rssCurrentTag] .= $characterData; } elseif($rssBlockLocation == "ITEM"){ $rssTempItem[$rssCurrentTag] .= $characterData; } } } // Set up Variables to keep track of the position in the XML $rssBlockLocation = ""; $rssCurrentTag = ""; // Set up Variables to hold the data extracted from the XML $rssChannelArray = ""; $rssTempItem = ""; $rssItemArray = ""; // Read in the XML $url = "http://rgweb-c.registerguard.com/blogs/index.php/ducksbkn/rss_2.0/"; $xml = readXML($url); // Parse the XML $parser = xml_parser_create(); xml_set_element_handler($parser,"startTag","endTag"); xml_set_character_data_handler($parser,"characterData"); if(!xml_parse($parser,$xml)){ $error = xml_error_string($xml_ger_error_code($parser)); $line = xml_get_current_line_number($parser); die("XML Error: " . $error . " at line number " . $line); } xml_parser_free($parser); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>RSS Feed - Macromedia Dreamweaver MX</title> <style type="text/css"> <!-- #rssFeed{ width: 400px; } .channelHeadline{ font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; } .itemDescription{ font-family: Arial, Helvetica, sans-serif; font-size: 12px; } a{ font-family: Arial, Helvetica, sans-serif; font-size: 12px; } a:link{ color: #009900; text-decoration: none; } a:visited{ color:#009900; text-decoration: none; } a:hover{ color:#009900; } a:active{ color:#009900; text-decoration: none; } --> </style> </head> <body> <?php echo "<div id='rssFeed'>"; // Output Channel Header echo "<span class='channelHeadline'>" . $rssChannelArray['TITLE'] . "</span><br />"; echo "<a href='" . $rssChannelArray['LINK'] . "'>" . $rssChannelArray['DESCRIPTION'] . "</a>"; echo "<br />"; // Output Items foreach($rssItemArray as $item){ echo "<hr width='100%' align='left'>"; echo "<a href='" . $item['LINK'] . "'>" . $item['TITLE'] . "</a>"; echo "<br />"; echo "<span class='itemDescription'>" . $item['DESCRIPTION'] . "</span>"; echo "<br />"; } echo "</div>"; ?> </body> </html> If you can help in anyway, I'd be so greatful. Thanks for any help in advance.
  3. Or does anyone know what it's called so i can google it. Or if you know where a tutorial is, that'd be great too.
  4. I'm new to javascript and don't know what this is called to search for a tutorial and none of my books touch on this, but I've seen it done. I want the user to select a number, on change depending on the number they selected it would then create than many form inputs. here's my form code: <p>How many times? <select name="numTimes" id="numTimes"> <option value="">--</option> <?php $maxNum = 15; for ($i=1; $i<=$maxNum; $i++) { echo "<option value=\"$i\">$i</option>\n"; } ?> </select> <br /> <!-- this div is what i need to be repeated depending on the number the user selected --> <div id="mulitpleTimeEntryForm"> Start Date & Start Time: <input type="text" id="mulitpleDate1" maxlength="25" size="25" name="multipleDate1" value="<?php if(isset($_POST['date'])) { echo $_POST['date']; } ?>" /> <a href="javascript:NewCal('multipleDate1','mmddyyyy',true,12,'dropdown',true)"><img src="images/cal.gif" width="16" height="16" border="0" alt="Pick a date" /></a> Duration: <input name="multipleDuration1" type="text" id="mulitpleDuration1" size="4" maxlength="5" /> in hours </p> </div>
  5. This is what it looks like: I want the <h4>Former IU Steeplechaser Goes Grom Zero to Hero</h4> to be below the picture. When I add a clear:left attribute to the h4 element, it clears it, but all the way down past my "leftside" which is floating:left as well. Is there any way around this? You can see the html here: http://www.athleticsconsulting.com/news-dynamic.php You can see my css for it here: http://www.athleticsconsulting.com/css/main.css
  6. This is my query to select bowl game info i need. SELECT * FROM bowl_games bg LEFT OUTER JOIN bowl_teams t1 ON t1.team_id = bg.away_id LEFT OUTER JOIN bowl_teams t2 ON t2.team_id = bg.home_id WHERE bg.date >= 1198310400 AND bg.date <= 1198396799 ORDER BY bg.bowl_game_id ASC I have another table "winners": [winner_id] [game_id] [winner] I want to select everything i am in my code above, except where the bg.bowl_game_id is in the winners.game_id column. How do i do that?
  7. here's my table: Let's say we're talking about game 1 (G1): I want to get three things in one query: 1. The total number of picks made >> [ SELECT COUNT(G1) AS total FROM `picks` ] will get me that Can i combine that with: 2. The total number of times team 1 was picked ( the 1's in the G1 column) >> I can use "SELECT COUNT(G1) AS AwayTeamTotal FROM `picks` WHERE G1 = 1" 3. The total number of times team 2 was picked ( the 2's in the G1 column) >> I can use "SELECT COUNT(G1) AS HomeTeamTotal FROM `picks` WHERE G1 = 2" Is there a way to get all those queries into one, just so i don't have to go to it three times?
  8. I got 2 tables: TABLE: "users" game_total_id user_id game_id W L FW FL FPTS OTW OTL OTPTS PTS TABLE "game_totals" user_id first_name last_name email password I'm having to use 2 functions to get user specific information from them. I'm trying to the the record from the last five games (ie 3-2) and the result of the last game (W or L). Is there a way I can do it in all one query without the functions? <?php function getLastFive ($uid) { $query = "SELECT * FROM `game_totals` gt WHERE user_id = $uid ORDER BY `game_id` DESC LIMIT 0, 5"; $db_query = mysql_query ($query) or die (mysql_error()); $w = 0; $l = 1; while ($row = mysql_fetch_array ($db_query)) { $w = $w + $row[W]; $l = $l + $row[L]; } $record = $w . '-' . $l; return $record; } function getLastGame ($uid) { $query = "SELECT * FROM `game_totals` gt WHERE user_id = $uid ORDER BY `game_id` DESC LIMIT 1"; $db_query = mysql_query ($query) or die (mysql_error()); $row = mysql_fetch_array ($db_query); if ($row[W] == 1) { $LG = 'W'; } else { $LG = 'L'; } return $LG; } $query = "SELECT u.user_id, CONCAT(u.first_name, ' ', u.last_name ) AS name, CONCAT(SUM(gt.W),'-', SUM(gt.L)) AS record, SUM(gt.PTS) AS pts, CONCAT(SUM(gt.FW),'-', SUM(gt.FL)) AS F, CONCAT(SUM(gt.OTW),'-', SUM(gt.OTL)) AS OT FROM game_totals gt INNER JOIN users u ON u.user_id = gt.user_id GROUP BY (u.user_id) ORDER BY (pts) DESC"; $db_query = mysql_query ($query) or die (mysql_error()); while ($row = mysql_fetch_array ($db_query)) { $Last5Games = getLastFive ($row[user_id]); $LastGame = getLastGame ($row[user_id]); echo "<tr class=\"$rowcolor\"> <td>[ $rank ] </td> <td>$row[name]</td> <td>$row[pts]</td> <td>$row[record]</td> <td>$row[F]</td> <td>$row[OT]</td> <td>$LastGame</td> <td>$Last5Games</td> </tr>\n"; } ?>
  9. I have 4 drop down menus that all have the same options, but they're named "F1", "F2", "F3", "F4". Each one needs a different option selected. I don't want the same option selected from each. I'm not super good at javascript and ideally i'd like the option that i select in one to be removed in the others. But that's pretty advanced for me to try. If you want to tackle that, i'd love it. But, anyways, I figured I'd just check to make sure none of the selectedIndexes equal each other. However, even when I select all different options, my script still says that one of them equals each other. What's wrong with my method? What will fix it? Is there a better way to do this? // this is within a function that's checking a huge form of data, here's just the part we're dealing with here. // check to see if any equal each other if (document.picks.F1.selectedIndex == document.picks.F2.selectedIndex || document.picks.F1.selectedIndex == document.picks.F3.selectedIndex || document.picks.F1.selectedIndex == document.picks.F4.selectedIndex || document.picks.F2.selectedIndex == document.picks.F3.selectedIndex || document.picks.F2.selectedIndex == document.picks.F4.selectedIndex || document.picks.F3.selectedIndex == document.picks.F3.selectedIndex) { alert("Sorry, but your selections can't be the same."); document.picks.F1.focus(); // i'd really like it to focus on the problematic box, but return false; }
  10. would it be possible to make a function that would count everytime they "changed" and input box and say there are 15 input boxes on the page. When the function got to 15 it would enable the submit button. Ideas?
  11. Ideally, I would like my submit button to be disabled until all the fields are filled in. I had a go at it by having a "check" button (which i think is unneccessary, but I don't know how to do it otherwise). I followed a tutorial on disabling submit, but it wasn't exactly what I am trying to do and it's not enabling my submit button. I need help with: 1. Having the submit button being disabled until all the forms are filled in. 2. If it can be done without my lame "check" button that'd be awesome too. <form action="" method="post" name="myForm"> <table width="752" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="135">AWAY</td> <td width="133">HOME</td> <td width="132">WINNER</td> <td width="132"> </td> </tr> <tr> <td><a href="javascript:void(0);" onClick="setWinner('Oregeon State',0);" id="linkaway0">Oregon State</a></td> <td><a href="javascript:void(0);" onClick="setWinner('Oregon',0);" id="linkhome0">Oregon</a></td> <td id="row0"> </td> <td><input name="ot0" type="text" id="ot0" size="3" /></td> <input type=hidden id="winner0" name="winners[]" value=""> </tr> <tr> <td><a href="javascript:void(0);" onClick="setWinner('Washington',1);" id="linkaway1">Washington</a></td> <td><a href="javascript:void(0);" onClick="setWinner('Washington State',1);" id="linkhome1">Washington State</a></td> <td id="row1"> </td> <td><input name="ot1" type="text" id="ot1" size="3" /></td> <input type=hidden id="winner1" name="winners[]" value=""> </tr> <tr> <td colspan="4"><div align="center"><input name="checkForm" type="button" id="checkForm" onClick="checkForm()" value="Check" /> <input name="Submit" type="submit" disabled value="submit" id="submitButton" /></div></td> </tr> </table> </form> <script language="JavaScript" type="text/javascript"> <!-- function setWinner(clickedObjId,row) { document.getElementById('row'+row).innerHTML = clickedObjId; document.getElementById('winner'+row).value = clickedObjId; } function checkForm () { for (var i=0; i<=1; i++) { if ( document.getElementById('winner' + i).value == "" ) { alert ( "Please enter your zip." ); document.getElementById('row' + i).focus(); return false; } } if (true) { myForm.Submit.disabled = true; } } // --> </script>
  12. thanks. Is there anything for javascript that will point the errors out like php does? Php tells you which line your error is on and makes it a little easier if you happen to have a ',' instead of a ';'
  13. i have 32 images in a folder. they're named: 0.gif, 1.gif, 2.gif,..., 30.gif, 31.gif I want to preload all those images. Preloader is my function that doesn't work and makes my other function "setWinner" to not work. <script language="JavaScript" type="text/javascript"> <!-- function setWinner(clickedObjId,row) { document.getElementById('row'+row).innerHTML = '<div align="center"><img src="team_logos/' + clickedObjId + '.gif" width="80" height="80" /></div>'; document.getElementById('winner'+row).value = clickedObjId; } function preloader () { imageObj = new Image(); for(var i=0, i<=31; i++) { imageObj.src = 'team_logos/' + i + '.gif'; } } // --> </script>
  14. I have two tables: "bowl_games" and "teams" table "bowl_games: table "teams": I'm trying to select the following with only query if possible: bowl_games.bowl_game_id, bowl_games.name, bowl_games.date, AND teams.team_id, teams.name, teams.record, teams.rank (from the home_id & away_id associated to the bowl_game_id) This is the query I used, but as you can see I'm getting the bowl_game info twice. SELECT bg.bowl_game_id, bg.name, bg.date, t.team_id, t.name FROM `bowl_games` AS `bg`, `teams` AS `t` WHERE bg.away_id = t.team_id OR bg.home_id = t.team_id Is it possible? What would you do?
  15. I'm making a form for selecting a winner from 32 games. the table has 3 columns and at least 32 rows: [away team] [home team] [picked winner] I need javascript to put the team that you click on into the "picked winner" cell of the table. and then I want to be able to submit/post all the teams in the "picked winner" cells to be handled by php. I don't like the idea of text fields, because I don't want a bunch of text fields on the page. (remember there's 32 games). How would I do this, or what is this called so I can google it for a tutorial of some sort. Any ideas, or help would be great. Here's the basic table i created for it. The first row of teams is what I want it to be like after the user clicked on Oregon. <form action="" method="post"> <table width="400" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="135">AWAY</td> <td width="133">HOME</td> <td width="132">WINNER</td> </tr> <tr> <td><a href="#">Oregon State </a></td> <td><a href="#">Oregon</a></td> <td>Oregon</td> </tr> <tr> <td><a href="#">Washington</a></td> <td><a href="#">Washington State</a> </td> <td> </td> </tr> <tr> <td colspan="3"><div align="center"> <input type="submit" name="Submit" value="Submit" /> </div></td> </tr> </table> </form>
  16. SELECT section FROM `media` ORDER BY(section +0), SUBSTR(section, 3) That does the trick.
  17. okay, so i get it to sort by the first number with with, but i don't know about the ones after the ":"... ideas? SELECT section FROM `media` ORDER BY (section +0) 1:3-31 1:1-2 2 3:1-24 3:1-24 4 6:1-22 6:1-22 7 8 8:6-12 9 9:18-27 10 11 12 12:1-3 13-14 14:17-24 15 15 16-17 17-18 17:15-22 18:16-33 20:1-2 21:9-14 22:3-19 22:1-2 24:61
  18. i have a mysql db with a column called "section". I want it to sort ascending, but it's not sorting the way i want it too. This is how it's sorting. 10 11 12 12:1-3 17:15-22 18:16-33 1:1-2 1:3-31 2 20:1-2 21:9-14 22:1-2 22:3-19 24:61 Is there a way I can get it to sort it so it'd be: 1:1-2 1:3-31 2 11 12 12:1-3 17:15-22 18:16-33 20:1-2 21:9-14 22:1-2 22:3-19 24:61
  19. I have any number of text boxes, lets say 4 for example. Named: a, b, c, & d. Each start with the values 1,2,3, & 4. I want to make it so when the user changes the rank, it will swap with the other box that had that value. For example, lets say the user changes box "c" from 3 to 1. I then want box "a" to automatically change to 3. Also, I want them to do it as much as they want and still work. I'm pretty new at javascript, I know php pretty well and would use an array in php but arrays in javascript are quite the same. This is what i have so far, but I don't know if it's in the right direction. Any help would be great, or any articles or tutorials you know of would be awesome too. thanks. <script type="text/javascript"> function updateForm (newValue) { var newVal = newValue.value; alert("the value of the box that was changed is: " + newVal); } function currentVal (currentValue) { var currentVal = currentValue.value; var currentName = currentValue.name; alert("the current value of the box is: " + currentName); } </script> <form id="rankem" name="rankem" method="post" action=""> <p> <input name="a" type="text" id="a" size="3" value="1" onchange="updateForm(this);" /> </p> <p> <input name="b" type="text" id="b" size="3" value="2" onchange="updateForm(this);" /> </p> <p> <input name="c" type="text" id="c" size="3" value="3" onchange="updateForm(this);" /> </p> <p> <input name="d" type="text" id="d" size="3" value="4" onchange="updateForm(this);" /> </p> </form> i need the current value, and the new value... i can get them with my different functions... but i don't know how to get them together at once.
  20. magic quotes are enabled on my server. I'm storing a blog into a database and when i use php to print it out i get question marks the like one below. What do i need to do? I've tried addslashes() but that didn't help at all. Is there something in between the database and php that i need to do? If i paste the text right into the db, it doesn't have the "[?]" thing code writing the text to db $blog = nl2br(trim($_POST['blog'])); $query = "INSERT INTO `blogs` (`team_id`, `title`, `blog`, `blogger_id`, `date_posted` ) VALUES ('$team_id', '$title', '$blog', '$blogger_id', '$timestamp');";
  21. Thanks, it works. That was driving me crazy.
×
×
  • 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.