Jump to content

JasonLewis

Members
  • Posts

    3,347
  • Joined

  • Last visited

Everything posted by JasonLewis

  1. Great music actually exists nowadays, it's just mainstream media slams shit down our throats. The Wombats are an excellent example of quality tunes.
  2. The same would apply doubledee, there would be no benefit (probably more of a bad thing if anything) from doing that. Google does use the description meta tag for page descriptions on search results. They don't do it all the time, but some of the time they will. It'd be pretty ugly seeing a search result that consisted of a description with hyphenated words. You'd be better off giving each of your pages a unique and well written (yet still short) description and Google will love you.
  3. Sorry, you should probably use strtotime on the $_POST variable. $end_time = date("H:i", strtotime($_POST['end_time'])); The reason being is you want the unix timestamp of the time you select in the dropdown.
  4. You might try to use file_get_contents, not sure if it will work or not. Make sure you read the notice at the bottom of that manual entry about fopen wrappers.
  5. You'd need to use a combination of cURL and json_decode() to convert the stored object into a PHP-friendly object or array.
  6. I'd like to point out that suppressing errors with @ for $_POST['commentbtn'] isn't a good approach. Instead, use isset if(isset($_POST['commentbtn']))
  7. Depends how I feel. Sometimes I forget about tunes and just get stuck into it. Othertimes I'll have something playing in the background. I don't like using headphones though.
  8. I believe _() is a function in PHP, but not __(). In your __() function you'd need to explode on the dots. Then, you'd need to loop over each bit and see if it exists in the language array. function __($line) { include('lang/en/en.php'); // Explode the $line variable into bits. $bits = explode('.', $line); // Start the phrase off as false, that way the first if statement will evaluate to true, assuming the bit exists in the language array. $phrase = false; foreach($bits as $bit) { if($phrase === false && isset($lang[$bit]) { // Now set $phrase to the current bit in the language array. $phrase = $lang[$bit]; } elseif(isset($phrase[$bit])) { // And continue to update it accordingly. $phrase = $phrase[$bit]; } else { // Could not find the correct phrase. return false; } } // Return the phrase return $phrase; } So again let's use the $lang array I defined earlier. If we were to echo __('en.welcome_text'); our function would break that apart into an array like: Array ( [0] => 'en', [1] => 'welcome_text' ) So we run this through the loop, and the first check is to see if $lang['en'] exists, and it does, so we update $phrase to be $lang['en']. Then the next itteration occurs. And the elseif() is fired which also evaluates to true because $lang['en']['welcome_text'] exists in the $lang array. After the loop it returns this phrase and hey presto we have our phrase we wanted translated.
  9. Generally, in most multi-lingual based applications they'll use a function like __() to echo out the translations. Most of these use the dot separated syntax. Take my first array for example, to access the welcome_text property you'd call something like this: echo __('en.welcome_text'); The __() function would then break it apart and check the array for the existence of said keys, and if so return the resulting text. Something to point out is that you shouldn't echo from within a function like that, it's nicer if you return the string.
  10. Cookies are stored to a specific domain. So no, you cannot access other websites cookies. That would be a massive security flaw. Users can look at cookies sites set for them though, depending on their browser.
  11. You can set checkbox names to something like: <input type="checkbox" name="id[]" value="<?php echo $id; ?>" /> That way multiple checkboxes can be submitted as an array to PHP. You can then implode it with a comma as a delimiter and use MySQLs IN function.
  12. Why not define it in a multi-dimensional array, be a hell of a lot more organised. And regardlesss, your going to end up with lots of keys in the array for translating purposes. $lang = array( 'en' => array( 'welcome_text' => 'Your welcome text in english' ) ); Of course you could have separate files for each language and so on.
  13. Your explanation is a bit rough. To begin with, avoid using $_REQUEST, as this is populated with not just POST data but GET data as well and can lead to unexpected results. If you want post data, use $_POST and same applies to $_GET, only use it if that is what you are expecting.
  14. Paul Graham makes some excellent points.
  15. You'd be better off posting the code you're having problems with, and not entire files. It makes it easier for us to help you. Post the code that is causing the errors, and the errors themselves. Just to clarify, you can't write HTML inside PHP unless it's stored in a variable or echo'd, and in those cases you must ensure your quotes are matched correctly. You can break out of PHP and have HTML & CSS in your code, then go back into PHP. Something like this is wrong: if($somevariable == 'somevalue'){ <input type="text" name="foo" value="bar" /> } That would throw an error, you need to use echo: if($somevariable == 'somevallue'){ echo '<input type="text" name="foo" value="bar" />'; }
  16. I think you're getting confused with strtotime() on line 35. You might want to use date() there instead as that would be better suited.
  17. It's called scope. You can see that in the function declaration there is $args = '', that is a single argument. You can have more by separating them with commas. function my_cool_function($arg1, $arg2, $arg3) You can define arguments are optional by setting a default value, which is what yours is doing. You can add another argument to the function and pass in the string when you need too. Otherwise you can use the global keyword, although it's not exactly a solution but more of a bandaid to your problem.
  18. I can't scroll right either. Perhaps it's a browser/resolution error? I'm running Firefox 5 @ 1920x1080. Here is a screencast of what I see: http://screencast.com/t/ogJx58JJI
  19. Well, before we can go anywhere may I ask to see some code? How are the borders being applied to the table? To the table tag directly or to child TDs? Perhaps point us to a live example of the issues your having a provide some code for us to look over. But not all your code, just the code calling you troubles.
  20. I'm sorry, big gray box? Where is it exactly? I can't see it. Maybe I'm blind.
  21. May I first point out that opening a new window is considered a bad approach to user interface design, and that applies to websites. Of course there are exceptions but in general it's best not to open things in a new window, but instead allow the user to decide when they want to open things in new windows. This article by SmashingMagazine is a really good read on this. They make a few points where it may be acceptable to open in a new window: It's a help popup. You don't want to interrupt an important process, such as filling out a form etc. It's a link to an external PDF document or something. The article goes into much more detail about it, but those are a few examples. But on to your code. This looks like code from SMF. I'm just assuming this. I don't actually think you can set it to open in a new window directly from their, but instead you'd need to do it in the template file. This, again, is another guess. Honestly I have no idea. I'd suggest asking on the SMF forums, if this is indeed SMF code. Good luck.
  22. People actually use that shit? That's pretty sad. I hope no one hear uses it. My job usually requires lots of physical activity, so I rarely work out. Although occasionally I'll do something in my spare time. If you're sitting at a computer for that long, you should get a dumbell or something with a moderate weight and every now and again do a few sets or something, just to keep the muscles active. And stretch, always stretch.
  23. In my opinion, a better way that doesn't rely on Ajax is to create another column in your table called 'visit_timestamp' or something similar. On each page request for a user that's logged in you'd update their last visit timestamp to the current time. That way you can run a query to update any users and set their online='0' when their visit_timestamp is say, 10 minutes old. This won't log them out, but it will keep your counter or whatever this is for reasonably accurate.
  24. The error is in reference to the fact the the $_POST superglobal does not contain a key named 'notes'. In your form, you have "Notes:" There is no input field for this, instead you have what appears to be an image/link to another page. Perhaps you were not meant to insert the notes there?
  25. I take it you did not write this yourself. I doubt someone is going to fix it for you if it's broken, perhaps finding the original author and seeing if they can fix it? But anyway, do you get any errors or anything? Or does it just not work at all?
×
×
  • 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.