Jump to content

CroNiX

Staff Alumni
  • Posts

    1,469
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by CroNiX

  1. Changing languages wouldn't be a problem. Just load a different lang file. If it works so well, why did you have the question to begin with? Sounds like you just don't want to get your hands dirty and improve performance. Lots of things "work", but can always be improved upon and made more efficient.
  2. Oh my. I know you marked it as solved but this is really not the way to do it and is very inefficient and resource intensive. There is no reason to load all languages when only one will be used at a time. There is no reason to store them over and over again in session (in multiple languages) for each user. Personally, I'd do something like create a directory to hold the languages. /languages Then for each language, have that be the filename. /languages/EN.php /languages/DE.php /languages/ES.php Each file would be an associative array, like for EN.php: <?php $lang['welcome'] = 'Hello there!'; $lang['goodbye'] = 'Thanks for visiting!!'; The other files would look the same and have the same keys, but just the translation would be different. In your back end (I assume this is where you are creating the languages to store in the db), whenever you save a language/translation, have it create the above files. Then when you determine the users language, just include the specific language file. $lang = 'EN'; //This users language is English include 'languages/' . $lang . '.php'; //load whatever lang file the user needs echo $lang['welcome']; I believe this would accomplish what you are after as it would eliminate querying the database (except when creating/editing a language) and they would be 'cached' for all intents and purposes. It would be faster and more efficient as you would only load the language you need and you wouldn't need to use session to store them at all.
  3. It might help more to explain what you want the end result to be.
  4. I don't understand why you'd need to do that and it sounds very inefficient. Personally I'd only store entries for days that have some sort of "event". Then build the calendar for a given month and query the db for all entries in that month. When building the calendar day by day, check to see if an event exists for that "day" from your result set and if so display it.
  5. because print_r sends to the output and doesn't return a string unless you set the 2nd parameter to TRUE. http://php.net/manual/en/function.print-r.php
  6. Here's an example using the api to show a simple marker: https://developers.google.com/maps/documentation/javascript/examples/marker-simple
  7. Sounds like you really should be posting this in the job offerings forum and pay someone to do it for you. People are willing to help you if show what you have tried and are having problems, but not just to do something for you.
  8. You can also try doing it in cycles of 1000 records at a time instead of all at once and then free the result after each cycle.
  9. if (your check) { return value; } return false; //this will only be returned if the above isn't true I usually use something like above so I can test if the returned value === false to know if it failed.
  10. You can? Maybe you have before because you had name, id and class all the same. But in the case above there is no class "token" so it won't work. It would work if you used the ID $("#token").attr('value', data.token);
  11. What do you mean by validate? This is a very broad question.
  12. I'd look into creating a custom map and saving that so you can "share" it and then link to it. https://support.google.com/maps/answer/62843?hl=en https://support.google.com/maps/answer/144365?hl=en&ref_topic=1687289 If you're going to be doing a lot of maps, I'd just look into using the Google Maps API
  13. Time to put your troubleshooting skills to work. Make sure you close all braces. I spot one that isn't. If you indent your code, it will make thins like this MUCH easier to spot. if (some condition) { foreach (something as something_else) { $x = 1; $y = 2; } } See how they all line up? The if opening and closing brace, the foreach opening/closing brace, and the code indented one more time within them? Visually easy to spot errors like you have. If everything is mashed up against the left margin...that's a pain to read....and troubleshoot. It makes things harder to figure out.
  14. It is much easier to use the imap functions rather than trying to parse it yourself. I pipe email to a script as well, but all it does is trigger the imap functions. http://php.net/manual/en/book.imap.php
  15. I'd also use the MySQLi driver and not MySQL because that driver is now deprecated in php. That or PDO.
  16. try commenting this out $userid = addslashes($_POST["userid"]); You're saying you get the correct username when you echo $userid? The line above is setting the value from $_POST, so use the $userid that you're echoing.
  17. target the tbody of the table.fullwidth
  18. You are most likely getting a blank page because you have display_errors turned off, and there is a fatal error. Turn it on and check your error logs in the meantime. What is this? accos? while($row = $result->fetch_accos()){ Why are you not putting quotes around the keys, since they're strings, in your associative array? <td>$row['Scott']</td>
  19. Also, it appears that if you have a title that starts with a lower case "a" and another with a capital "A", it will output in 2 separate headers instead of putting them both under "A". I'd change these lines: $currLetter = strtolower(substr($row, 0, 1)); //force to lowercase for the comparison echo "<h3>" . strtoupper($currLetter) . "</h3>"; //output uppercase
  20. Where does $counter come from? It looks like that should be $count? Not a big deal, but you could use is_numeric() here (I think it reads a little better): if(strpbrk($currLetter, '0123456789') == true) { if (is_numeric($currLetter)) {
  21. Do you mean the text box in the center that starts to populate some options as you type? If so, that's called an autocompleter. You can search for it or use something like from jQueryUI. http://jqueryui.com/autocomplete/ You'd just use "function" as the source and trigger an ajax call that hits a certain URL on your server. Then have your script query the db and return results back which then get populated in the "dropdown".
  22. Also look into the robots.txt file, which also helps block indexing pages you tell it. No method used will guarantee that some bot doesn't index your pages though...as they ARE public.
  23. Try removing all of the \r's from these lines so that there is only \n's $diyf_mailHeader .= "MIME-Version: 1.0\r\n"; $diyf_mailHeader .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $diyf_mailHeader= "From: $email\r\n" . "Reply-To: $email\r\n" . "X-Mailer: PHP/" . phpversion(); $diyf_mailHeaderToUser .= "MIME-Version: 1.0\r\n"; $diyf_mailHeaderToUser .= "Content-type: text/html; charset=iso-8859-1\r\n"; $diyf_mailHeaderToUser= "From: $diyf_mailTo\r\n" . "Reply-To: $diyf_mailTo\r\n" . "X-Mailer: PHP/" . phpversion(); I'm assuming this is a linux system you are sending from.
  24. What does that mean? What does it look like in the email then? Have you viewed the raw email to see what the content actually looks like?
  25. It kind of depends on how you are accessing them to begin with. If in a database, you can just specify the ORDER. If coming from somewhere else, you can put the values into an array and then sort() them.
×
×
  • 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.