Jump to content

jdubwelch

Members
  • Posts

    85
  • Joined

  • Last visited

    Never

Everything posted by jdubwelch

  1. I used to have many many (like 90 redirects). But that crashed the server. So I need to figure out a new way to do this. My old redirects is this: <IfModule mod_rewrite.c> # Enable mod_rewrite RewriteEngine On # Permalinks# Rewrite Rules for OregonRewriteRule ^NCAA/Pac-10/Oregon-Ducks/$ index.php?teamID=1RewriteRule ^NCAA/Pac-10/Oregon-Ducks/page/([0-9]+)/ index.php?teamID=1&page=$1RewriteRule ^NCAA/Pac-10/Oregon-Ducks/category/([0-9])/.*/page/([0-9])/ categories.php?teamID=1&catID=$1&page=$2RewriteRule ^NCAA/Pac-10/Oregon-Ducks/category/([0-9]+)/ categories.php?teamID=1&catID=$1RewriteRule ^NCAA/Pac-10/Oregon-Ducks/source/([0-9]+)/.*/page/([0-9])/ sources.php?teamID=1&sourceID=$1&page=$2RewriteRule ^NCAA/Pac-10/Oregon-Ducks/source/([0-9]+)/ sources.php?teamID=1&sourceID=$1RewriteRule ^NCAA/Pac-10/Oregon-Ducks/date/([0-9]{4}\-[0-9]{2}\-[0-9]{2})/.*/page/([0-9])/ date.php?teamID=1&date=$1&page=$2RewriteRule ^NCAA/Pac-10/Oregon-Ducks/date/([0-9]{4}\-[0-9]{2}\-[0-9]{2})/ date.php?teamID=1&date=$1RewriteRule ^NCAA/Pac-10/Oregon-Ducks/popular/page/([0-9]+)/ popular.php?teamID=1&page=$1RewriteRule ^NCAA/Pac-10/Oregon-Ducks/popular/ popular.php?teamID=1RewriteRule ^NCAA/Pac-10/Oregon-Ducks/contribute/ contribute.php?teamID=1RewriteRule ^NCAA/Pac-10/Oregon-Ducks/contribute-feed/ contributeFeed.php?teamID=1RewriteRule ^NCAA/Pac-10/Oregon-Ducks/m mobile.php?teamID=1RewriteRule ^NCAA/Pac-10/Oregon-Ducks/([0-9]+)/ headline.php?teamID=1&id=$1... times 90 (one set for each team) ...</IfModule> As you can see there a "dummy" folder structure /NCAA/Pac-10/Oregon-Ducks that is loading the root directory file index.php?teamID=1 I'm told by my server admins that I can't have that many in one htaccess file, So i'm trying to figure a way around this. I was thinking of creating the folder structure for each team and having the htaccess file in that folder creating the redirects back to the root directory. But I don't know how to do that. i tried: <IfModule mod_rewrite.c> # Enable mod_rewrite RewriteEngine On# Rewrite Rules for OregonRewriteRule ^NCAA/Pac-10/Oregon-Ducks/$ ../../../index.php?teamID=1 # End Permalinks</IfModule> but that didn't work. Here's the structure if it helps: php_value include_path ".:/Applications/MAMP/htdocs/projects/oneclicksportsnow/trunk/html/" Inside /html/ are all my working files that read in and display dynamic data based on teamID (ie index.php, categories.php, sources.php, etc) I then would have: /html/NCAA/Pac-10/Oregon-Ducks/.htaccess Directing everything back to the root.
  2. I guess I'm still confused. With your method, how would I tell the script what teamID it is? Here's a link to all rewrites i will need..... http://oneclicksportsnow.com/tmp/htaccess.php to do. I'm not sure if i can just do a regex for the whole url... because i've got to include the teamID for each one. I noticed with yours you have teamID=$1, but how will that send the teamID to the script?
  3. So here are more examples of teams (these are just for the index page not all the other pages though): RewriteRule ^NCAA/Big-12/Colorado-Buffaloes/$ index.php?teamID=12 RewriteRule ^NCAA/Big-12/Texas-Longhorns/$ index.php?teamID=20 RewriteRule ^NCAA/Big-10/Ohio-State-Buckeyes/$ index.php?teamID=30 RewriteRule ^NCAA/SEC/Florida-Gators/$ index.php?teamID=37 The only variable I need is the teamID to make the page display correctly. However, I want the url structure to be based on that team info. Which is <sport>/<conference>/<team>/ So rather that /index.php?teamID=12... I want the sport/conference/team/.
  4. For this project I'm working on, I need to create friendly URLs using mod_rewrite. This is what I've generated to create the create links: RewriteRule ^NCAA/Pac-10/Oregon-Ducks/$ index.php?teamID=1 RewriteRule ^NCAA/Pac-10/Oregon-Ducks/page/([0-9]+)/ index.php?teamID=1&page=$1 RewriteRule ^NCAA/Pac-10/Oregon-Ducks/category/([0-9])/.*/page/([0-9])/ categories.php?teamID=1&catID=$1&page=$2 RewriteRule ^NCAA/Pac-10/Oregon-Ducks/category/([0-9]+)/ categories.php?teamID=1&catID=$1 RewriteRule ^NCAA/Pac-10/Oregon-Ducks/source/([0-9]+)/.*/page/([0-9])/ sources.php?teamID=1&sourceID=$1&page=$2 RewriteRule ^NCAA/Pac-10/Oregon-Ducks/source/([0-9]+)/ sources.php?teamID=1&sourceID=$1 RewriteRule ^NCAA/Pac-10/Oregon-Ducks/date/([0-9]{4}\-[0-9]{2}\-[0-9]{2})/.*/page/([0-9])/ date.php?teamID=1&date=$1&page=$2 RewriteRule ^NCAA/Pac-10/Oregon-Ducks/date/([0-9]{4}\-[0-9]{2}\-[0-9]{2})/ date.php?teamID=1&date=$1 RewriteRule ^NCAA/Pac-10/Oregon-Ducks/popular/.*/page/([0-9])/ popular.php?teamID=1&page=$2 RewriteRule ^NCAA/Pac-10/Oregon-Ducks/popular/ popular.php?teamID=1 RewriteRule ^NCAA/Pac-10/Oregon-Ducks/contribute/ contribute.php?teamID=1 RewriteRule ^NCAA/Pac-10/Oregon-Ducks/([0-9]+)/ headline.php?teamID=1&id=$1 There's 65 teams total though. That means I'd have to duplicate this code and have it in my .htaccess file 65 other times. The URL structure is based on team info determined by the teamID. Is there a better way to do this? With less code maybe? i read this article at sitepoint about the mapping feature of mod_rewrite (http://articles.sitepoint.com/print/guide-url-rewriting... that would essentially be what I want to do (a static file stores the ids and values as a lookup), but with my hosting company I don't have access to modifiy the httpd.conf file.
  5. Actual URL: http://localhost:8888/projects/oneclicksportsnow/html/layout.php?teamID=6 URL that I want to display: http://localhost:8888/projects/oneclicksportsnow/html/Pac10/Washington-State-Cougars/ I read a tutorial and this is what I've done. Modify httpd.conf RewriteMap teams txt:/projects/oneclicksportsnow/teamIDs.txt RewriteRule ^(.*)$ layout.php?teamID=${teams:$1|0} I have a text file saved as teamIDs.txt in the /oneclicksportsnow/ folder that is tab delimited like this: Pac10/Oregon-Ducks 1 Pac10/Oregon-State-Beavers 2 Pac10/Washington-State-Cougars 6 I restarted apache, typed this in "http://localhost:8888/projects/oneclicksportsnow/html/Pac10/Washington-State-Cougars/" and I get a 404 error. What am i missing?
  6. I have two arrays... $commonFields = array ('bed','bath','school'); $fieldNames = array ('Lisitng File #', 'Chain Y/N', 'Bedrooms', 'Half Baths', 'School District'); foreach ($fieldNames as $field) { // Find match in $commonFields } I was thinking using in_array but i need something more i need it to out put: Bedrooms, Half Baths, and School District
  7. I'm working on a project that is going to be on a bigger scale than I've ever done. I'm going to have about 65+ different pages all with the same template (or look), with different color schemes & content. Each page will run the same script, but display different content that is being queried from a MySQL Database based on an id. There will be a lot of content on the page that is coming from the DB. My question is... since they're all the same basic "template" do I just have that one file and read in the id to make them different. (ie... 1 file for 65 pages like index.php?id=45) OR set up a whole folder structure for each 65 pages. which would be something like this: NCAA index.php PAC-10 index.php OREGON-DUCKS index.php OREGON-STATE-BEAVERS index.php (times 8 more teams) SEC index.php FLORIDA-GATORS index.php LSU-TIGERS index.php (times 10 other teams) (times 12 other conferences) index.php in the example above would be the same except it's reading a different id. I know the folder structure would be overkill, but say each of the 65 pages are being looked at at the same time. Wouldn't that slow the scripts and page load down?
  8. I read some stuff and copied it, but I'm getting a 500 error. existing url: headline.php?headline=$headline_id&title=$headline_title rewrite to: headline/$headline_id/$headline_title/ this is my rewrite that errors out: RewriteRule ^headline/([0-9]+)/[A-Za-z0-9-]+)/?$ headline.php?headline=$1&title=$2 [L]
  9. Is it possible to have a pop up window pop up when a user leaves my website or home page to a different site? If so, how would you do it? Javascript is clientside and I'm assuming you would use javascript to do that.
  10. I'm trying to read in a rss feed and use it in my own php rss parser. I'm reading in a lot of feeds, but some don't work. I have an application on my computer called netNewsWire that reads tons of RSS feeds. I copied the feed url into my code and it errors out. When I type in the url into my browser nothing shows up as well. Is there a way to read it? or is that some security type thing so I can't do anything with it? an example url i'm trying to read in is: http://www.gazettetimes.com/?rss=sports/beaver_sports/football I don't know if you need to see my code or not, I can post it if you want or you can see it at: http://www.jwelchdesign.com/rssDMX-code.txt and this is the page that runs the script: you'll see that it errors out because it can't read anything in. http://www.jwelchdesign.com/rssDMX.php
  11. I host through mediatemple.net. I searched their support page for vhost and aliases and nothing relevant came up. I'm not to saavy with the "server" stuff. Is there a book on that or something I could read up on? Currently, I have a "main" site folder that uses $_GET to read in the $team_id variable. That's all I need to be read in and it works. However, the new version of the site i'm working on has session (user login/logout), and it's not working. So I'm going back to square one here.
  12. We have a site that (at it's most basic level) displays a bunch of news links for a sports team all from a database. Currently there are three teams that we are displaying news for. They're all the same website, except logos, colors, etc. They all have different domains, but are on the same server. What's the best way to get set this up? We may expand and have three times the sites that we have.
  13. I have two files: file #1: index.php <?php $team_id = 1; include ("test.php"); ?> file #2: test.php <?php global $team_id; echo "$team_id"; ?> I need (in the most basic form, $team_id to be a variable in test.php), however this method doesn't work. Suggestions?
  14. In phpMyAdmin my query works just fine, however when I paste it into my php code it doesn't work because I don't think I can set user defined variable in MySQL from a PHP query. There's got to be a way to do this. Can anyone help? Here's my MySQL query: set @rank = 0; SELECT FLOOR( (h.clicked / ( (UNIX_TIMESTAMP( ) - h.date_posted ) * 0.000277777778 )) *24) AS clicksPerHour, h.headline_id as id, @rank := ( @rank +1 ) AS rank FROM headlines h WHERE h.date_posted >= ( UNIX_TIMESTAMP( DATE_SUB( NOW( ) , INTERVAL 2 DAY ) ) ) ORDER BY `clicksPerHour` DESC LIMIT 0 , 20
  15. Okay, So this is what I got by trial and error. More error than anything. It doesn't seem to work. My page just loads and doesn't do anything. Any ideas? function validate_form() { var bracketArray = new Array('A', 'B', 'C', 'D'); for(var i=0; i<=bracketArray.length-1; i++) { var bracket = bracketArray[i]; for (var j=15; j>=1; --j) { document.write('<p>' + bracket + j + '<br />'); checkTeamsBefore (bracket, j); document.write('</p>'); } } return false; } function checkTeamsBefore (bracket, game) { var gameNum = 16 - game; var prevGame1 = game - gameNum; var prevGame2 = game - (gameNum + 1); if ((document.myForm.winner + game.value != document.myForm.winner + prevGame1.value) && (document.myForm.winner + game.value != document.myForm.winner + prevGame2.value)) { alert("Teams don't match up."); } else { alert("Teams do match. Game: " + bracket + game); } }
  16. I'm making a online march madness bracket. I need to validate two things: 1) That every field has a value 2) That the current field is a "parent" of the previous two games. There's roughly 60 games that I need to validate. On a smaller scale: Let's say each field below "A1 - A15" needs to have something it it. When the user clicks on A1 that value in A1 (which is the team the user thinks is going to win) goes to A9. And likewise the value of A3 or A4 will go to A10. Then when they click on A9 or A10 it will put that value in A13, etc. A1 A9 A2 A13 A3 A10 A4 A15 A5 A11 A6 A14 A7 A12 A8 So I need to validate that the value of A7 is actually in A5 or A6. Currently I'm doing that by: function validate_form() { if ( document.myForm.winnerA15.value == "" ) { alert ( "Please complete the form." ); return false; } if ((document.myForm.winner15.value != document.myForm.winnerA13.value) && (document.myForm.winnerA15.value != document.myForm.winnerA14.value)) { alert("Your champion is not in the championship game."); return false; } Is there a way to make it repeatable? I have 4 brackets: A, B, C, D Each bracket has 15 "winners"
  17. I got it to work. function setWinner(clickedObjId,row,nextRow) { var link1 = '<a href="javascript:void(0);" onClick="setWinner(\'' + clickedObjId + '\',' + nextRow + ',15);" id="linkaway' + nextRow + '">' + clickedObjId + '</a>'; document.getElementById('row'+row).innerHTML = link1; document.getElementById('winner'+row).value = clickedObjId; }
  18. So I'm making an online bracket submission form. I'm just trying to get it to work based on a javascript code I've used for something similar before. Basically, I want it so by clicking on the team you think will win, it will eventually end up in the "A15" cell. As of now, with my code: I can only get it to write one round (into the A9 through A12 cells). I'm pretty new at javascript and any help is great. here's my javascript and html: <script language="JavaScript" type="text/javascript"> <!-- function setWinner(clickedObjId,row,nextRow) { document.getElementById('row'+row).innerHTML = '<a href="javascript:void(0);" onClick="setWinner(' + clickedObjId +',' + nextRow + ',13);" id="linkaway' + nextRow + '">' + clickedObjId +'</a>'; document.getElementById('winner'+row).value = clickedObjId; } // --> </script> <form action="" method="post" name="myForm"> <table width="700" height="309" border="1" cellpadding="3" cellspacing="0"> <tr> <th width="133" colspan="3"><a href="javascript:void(0);" onClick="setWinner('TeamA',9,13);" id="linkaway9">TeamA</a></th> <td width="194" rowspan="2" id="row9">A9</td> <td width="185" rowspan="4" id="row13">A13</td> <td width="188" rowspan="8" id="row15">A15</td> </tr> <tr> <td colspan="3"><a href="javascript:void(0);" onClick="setWinner('TeamB',9,13);" id="linkhome9">TeamB</a></td> </tr> <tr> <td colspan="3"><a href="javascript:void(0);" onClick="setWinner('TeamC',10,13);" id="linkaway10">TeamC</a></td> <td rowspan="2" id="row10">A10</td> </tr> <tr> <td colspan="3"><a href="javascript:void(0);" onClick="setWinner('TeamD',10,13);" id="linkhome10">TeamD</a></td> </tr> <tr> <td colspan="3"><a href="javascript:void(0);" onClick="setWinner('TeamE',11,14);" id="linkaway11">TeamE</a></td> <td rowspan="2" id="row11">A11</td> <td rowspan="4" id="row14">A14</td> </tr> <tr> <td colspan="3"><a href="javascript:void(0);" onClick="setWinner('TeamF',11,13);" id="linkhome11">TeamF</a></td> </tr> <tr> <td colspan="3"><a href="javascript:void(0);" onClick="setWinner('TeamG',12,14);" id="linkaway12">TeamG</a></td> <td rowspan="2" id="row12">A12</td> </tr> <tr> <td colspan="3"><a href="javascript:void(0);" onClick="setWinner('TeamH',12,14);" id="linkhome12">TeamH</a></td> </tr> </table> A9<input type="text" name="winner9" id="winner9" value="" /><br /> A10<input type="text" name="winner10" id="winner10" value="" /><br /> A11<input type="text" name="winner11" id="winner11" value="" /><br /> A12<input type="text" name="winner12" id="winner12" value="" /><br /> A13<input type="text" name="winner13" id="winner13" value="" /><br /> A14<input type="text" name="winner14" id="winner14" value="" /><br /> A15<input type="text" name="winner15" id="winner15" value="" /><br /> <p> <input name="Submit" type="submit" value="Submit" /> </p> </form>
  19. I'm linking to tons of feeds (lots are having this problem), so i was just trying to make this one work and implement it on the rest. There's so many feeds I probably wont get the actual link to the xml file. How can I read in their feed, and make a temporary xml file on my server to read it, then delete it?
  20. It's not my feed so it's not a local feed. Unless, there's a way to make it local just to load the file temporarily and then get rid of it. Ideas?
  21. Okay. I have multiple database driven sites that are running off of the same "skeleton". ("skeleton" meaning that it's reading in an id, and based on that id it gets that info from the database). I'm wondering if I'm doing this the right way, or if there's a better way to do it with sessions or cookies or some other way. Just want to see what ya'll think So, my skeleton is made of up 2 main pages: index.php and tags.php which both use included header.php & footer.php files. The skeleton and "id pages" are under different urls. The "id pages" have index.php & tags.php and look like this: <?php $team_id = 1; // other "id pages" will read in other id's if (isset($_GET['date'])) { $date = $_GET['date']; $link = "&date=$date"; } if (isset($_GET['source_id'])) { $source_id = $_GET['source_id']; $link = "&source_id=$source_id"; } include ("http://www.oneclicksportsnews.com/sites/index.php?team_id=$team_id" . $link); exit(); ?> Tags.php is similar: <?php $team_id = 1; // other id pages will have the differenent id. $tag = $_GET['tag']; include ("http://www.oneclicksportsnews.com/sites/tags.php?tag=$tag&team_id=$team_id"); ?> then the SKELETON index.php: <?php $team_id = $_GET['team_id']; include ('header.php'); // all the index content would be here include ('footer.php'); ?> Tthe SKELETON tags.php is basically the same as index, but it's just showing different data. My problem I guess is the just double up of each page that I have to do under each different url. Right now I only have 3 different "id's" reading into it. But later on down the road when there's 20 sites and I want to add something, I don't want to have to add a new page just telling it what id to read in for 20 different sites. Does that make any sense at all?
  22. I want to create the link for them. So, it alerts them to enter the title "click here", then prompts them for the link "http://www.whatever.com"... then it would add <a href="http://www.whatever.com">click here</a> at the spot where the curser was and then the cursor would go to the end of that, so they could keep on typing.
  23. phpQuestioner: So you're script you wrote is great. How would I incorporate this code for adding a link to the script you wrote? function addLink (id) { var currentText = document.getElementById(id).value; var newLink = prompt("Enter the link.", "http://"); var linkTitle = prompt("Enter the title of the link.", ""); var addText = currentText + " <a href=\"" + newLink + "\">" + linkTitle + "</a> "; document.getElementById(id).value = addText; document.getElementById(id).focus(); }
×
×
  • 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.