Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. But it does have Tools > Developer Tools Which is similar in all the important ways (also available in IE8). And unlike firebug, it is native, built-in to the browser.
  2. are you putting the delete link in the foreach loop? before or after the $num = $num + 1? (it should be in the loop, before the increment).
  3. This is not a direct translation. For one thing, you replaced the start of string anchor tag with a word boundary. Those are not the same thing. Also, you threw in the case-insensitive modifier...why? ereg_replace is case-sensitive. eregi_replace is not. Your translation will now allow for matches like "....http://" " http://" "]]]]httP://" "#$htTP://" etc... Here is a direct translation: preg_replace('~^http://~', '', $url); As a note for migrating from the posix functions (eregxxx) to the pcre functions (pregxxx), 99.99% of the time there is no change needed to the pattern itself. Basically all you really need to do is throw a delimiter around the pattern (like in this case, ~ was used). All pregxxx functions must have delimiters around the patterns because pattern modifiers go in the pattern string too. "~pattern~modifier" The delimiter can be most any non-alphanumeric character, but /.../ ~...~ #...# and !...! are the ones I see most commonly used. Just remember whatever delimiter you choose to use, you must escape it if you need to use that character in the pattern itself (for this reason I avoid using / as delimiter because that comes up a lot in parsing html. For example, if / was used on your pattern, it would have looked like this: '/^http:\/\//' not as clear, right?). And for ereg vs. eregi, a pattern modifier is used instead of a separate function (the "i" that JAY added after the ending delimiter).
  4. As a best practice, you should rename your `by` column, since it is a reserved word. Using backticks to mark it as a column only works with mysql, so if you were to port to another db it won't work.
  5. I too was once a naysayer. I thoroughly resisted jQuery and other frameworks. I thought wtf is up with all these lazy bums who can't be bothered to learn real javascript? So I did it the "traditional" way. I wrote everything out, just like in Zanus's example. And it was tiresome, and I thought hey, why don't I just put all that into a little wrapper function to make it easier for me? And so I did. And with other things, too. Then one day I was forced to learn jQuery because of a particular problem with a particular project from a particular client. And that was when I realized that I had done exactly what jQuery had already done (only they did it better). To this day I proclaim jQuery is the greatest invention since sliced bread, and my only regret is how long I stubbornly refused to jump on the bandwagon.
  6. Yes, there is about a 24 hour delay. But I don't believe you when you say you "need" live results. Especially if you are already using GA...that 24 hour delay applies to everything else you are looking at already. I happen to do web analytics for a living. I have yet to meet a single client who "needed" live results. Bosses expect reports at most on a weekly basis, but usually monthly, quarterly or yearly. Big difference between need and want. But if you somehow think you are the exception, there are other tracking tools out there besides GA that are live. Yahoo Web Analytics and Omniture SiteCatalyst to name two. Dunno where you live but where I live it's not customary to ask someone to do work for free.
  7. largely depends on how you are getting the data from the database as to what you actually wanna do in the function, but for example sake let's assume you have a 2d array of data retrieved from database and it only contains data to actually be displayed: function getTableFormat($data) { $table = '<table>'; foreach ($data as $row) { $table .= '<tr>'; foreach ($row as $column) { $table .= '<td>' . $column . '</td>'; } $table .= '</tr>'; } $table .= '</table>'; return $table; } $data = array(); $data[] = array('id' => 1, 'name' => 'john'); $data[] = array('id' => 2, 'name' => 'betty'); $data[] = array('id' => 3, 'name' => 'sue'); $tableFormat = getTableFormat($data); This will return generic html table formatted data, and the $data array can be any number of rows/columns.
  8. use explode() to get each increment of the time, and mktime() to create a timestamp, then date() to format it as minutes only, then divide and round() to round the number.
  9. What you are wanting to do is called "campaign tracking" in the analytics worlds. Google Analytics does this sort of thing very well. You even use URL parameter(s) just as you have described. You can go to GA's URL Builder tool to get started, and follow the relevant links on the page to learn how to see the data within GA. If you insist on doing it yourself, the core script is relatively simple. Just setup a database with 2 columns, one for campaign code and one for number of hits. Then on your page, look for the variable and update your table accordingly. GA does a lot more than this, and consequently offers you a lot more insight than just answering the basic "how many people came to my site on this code?" question, but if that's all you're looking to do...well I would still suggest you do it with GA if you already have GA on your site because why reinvent the wheel?
  10. ...which can easily be circumvented. You should never validate client-side. You can find out the length of the string using strlen(). Make a condition that checks if string is greater than amount of chars you want to limit it by.
  11. well your current function has some variables being declared as global. It also has variables being passed to it. Do you not know what your own function is doing?
  12. .josh

    array

    As to what you are doing wrong... a) javascript is case-senstive, it is Array() not array() b) you cannot assign elements to the array by passing them in the Array() object instantiation. The only argument Array() accepts is an optional integer to specify the array length.
  13. Your main issue is your call to copy(). $_FILES['file1']['uploads'] does not exist. Go back and look at the tutorial, what they use in the copy()
  14. exit() stops the rest of the php script from being parsed. There is no javascript equivalent of php's exit(). As nogray mentioned, javascript "return" is the same as php's "return". It stops the rest of a function from running, returning what you specify. Usually it is the last thing you do in a function if the function is expected to return a value (as a "best practice" functions should always return a value): function blah() { var foo = 'bar'; return foo; } x = blah(); alert(x); // will alert 'bar' but it will also stop the function from completing wherever you put it: function blah() { var x = 0; for (var c = 0; x < 10; c++) { if (c == 5) return x; x = c; } return x; } n = blah(); alert(n); In this example, the 2nd return will never be executed, because once c equals 5, the current value of x is returned, which breaks out of not only the loop, but the function itself. if you just want to break out of the loop and not the whole function, use "break".
  15. Can clean that code up a bit... $slots = mysql_query("SELECT SUM(preserved) FROM treservations WHERE reservation_date='$reservation_date' AND reservation_hour='$reservation_hour' LIMIT 1") or die(mysql_error()); $total = mysql_result($slots,0); echo $total;
  16. I think you need to go back and read that w3c tutorial more carefully...what you are doing is nothing like what is in that tutorial.
  17. $users_map is not within scope of your function. Either declare it as a global variable or pass it to the function.
  18. m tags!
  19. you should start a new topic for that, and you should give some more details about what "upload and send" means to you. Do you mean for a user to include an image in a feedback form and it gets uploaded and...then what? It gets sent to some email address? It gets stored on your server somewhere? But make a new topic.
  20. well I suppose one way you could do it is inside your condition: if($error == NULL) { // your other stuff } unset() all of the relevant variables ($myDate, etc...) or assign "" to all of them. unset($myDate); // do this for all of them // or $myDate = ""; // do this for all of them assigning an empty string value would be easier because if you unset them, you will generate a NOTICE error for using undefined variables in your form later on. It wouldn't break anything but if you aren't suppressing notices you may see a NOTICE error output from doing so. Which you can get rid of by altering the variables in the form code to look more like (have to do it for each form field): <?php echo (isset($Address))? $Address : ""; ?>
  21. More specifically, AT&T is the carrier - the provider of the cell phone service, where you would subscribe to your phone's services (phone service, data plan, etc...) - who you would be paying your monthly phone bill to.
  22. I'm torn on this. On the one hand, separating out classes for readability is very appealing to me, so therefore having to change a common color in one place instead of 20 is appealing to me. But on the other hand... IMO this is some kind of scope creep or something. In and of itself it doesn't seem so bad, but then what's next? Slippery slope in making CSS to evolve into its own language.
  23. .josh

    SEO

    No, I said I have read some of your posts, and I was specifically commenting towards the lack of mention about SEO for the posts of yours that I did read. I will concede though that maybe saying that your bite was a "style" was a bit misleading; I meant more like "Okay, if you wanna go there, then we can go there." Anyways, I fully admit that a lot of my posts are useless in the sense of actually solving the specific question at hand. And nobody once ever accused me of being tactful. But I assure you my "apparent uselessness" is because my overall perspective and goal is to teach a man to fish rather than do his fishing for him and IMO sugar coating something doesn't help at all. Take for instance this thread. You asked a vague question. I could have written a novel in response, basically reposting a lot of existing info already out there. Instead, I opted to give a vague answer in response, and it wasn't even a personal attack. Usually I would have cut to the chase and told you what I said in my 2nd post in the first place. I guess I was having an off-day I understand that you didn't know anything about SEO until just now. That wasn't the problem. The problem is that you came across it and then came straight here asking a vague question instead of doing some research first. Now you can be mad or upset or whatever you want to label it. You can call me an asshole or equivalent and for the most part I won't really argue that, but it doesn't change the fact that you asked a vague question and you really should have done some research and come up with more specific questions, instead of just throwing out a vague question and expecting people to personally walk you through a topic that has plenty of information out there already. You asked a vague question: "How does this affect my SEO"? I gave a vague answer: "You're fucked." You gripe about etiquette instead of ask more detailed questions, so I tell you more plainly in the "style" you chose to respond with to go research and come back with more specific questions. See the pattern here? I have no issues with helping you, and indeed, I want to help. But I'm not going to handhold you and I'm certainly not going to sugar coat things, especially when you're the one who started biting first. Read some articles. Start with the one Maq posted. Google "SEO best practices" take notes. Ask more specific questions, and I and others will try to give more specific answers.
  24. .josh

    SEO

    You asked a vague question so I gave you a vague answer. And by some freak accident I didn't even make it personal. But apparently that's your style and I'm totally fine with that because I like it when people bite. We aren't here to be someone's personal google service. Nor are we here to reinvent the wheel. It aggravates me when someone asks vague questions. It means they did little or no research on their own before posting. If you had done a search about SEO best practices before posting, you would have found a wealth of information about do's and don't's and if you still had questions, they would have been a lot more specific. And don't hide behind the "experts" here. Point in fact, most coding "experts" give little to no regard to SEO. It's one of those things people usually start thinking about after they get their site up and running, instead of thinking about it from the get-go. Same with tracking/analytics. Most web developers don't really think about a project or situation beyond what sits in front of their face. It's a shame, really, but that's the way it is. But for sure in this case... I have seen some but not all of your posts, and AFAIK you never mentioned SEO stuff before so I can hardly fault the "experts" around here for not coding towards that.
×
×
  • 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.