Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. Never wrote XHTML? You do know XML and XSLT, do you?
  2. I never said Smarty is a good templating engine. A template engine is to assist designers in creating the templates without having to learn PHP or anything complex, and PHPTal succeeds in this by using default XHTML syntax. If your template engine imitates basic PHP syntax then you could as well be writing PHP which in itself can be considered a template engine.
  3. Show all variables? Declare global variables? Include a file? Assign constants? That's not a template engine, but a programming language. Many of PHP's typical syntax is still visible. It should make designers easier to write/make templates. PHPTal really hits the nail on the head by allowing you to write simple XHTML to create your templates.
  4. Submit your POST data to different/same page, process it, then redirect them to wherever it is you want them to go. http://en.wikipedia.org/wiki/Post/Redirect/Get if($_SERVER['REQUEST_METHOD'] == 'POST') { // do stuff with $_POST // change from POST to GET header('Location: ' . $_SERVER['SCRIPT_NAME']); exit(0); } // form
  5. Should be correct, since lastbump <= lastbump - INTERVAL 10 MINUTE makes no sense as this will always be true regardless if it has been 10 minutes.
  6. Start there, don't bother with writing what has been done million times before. Use an existing DB class and write the code needed to complete the task at hand.
  7. If this is that light. Then it's in need of replacement.
  8. I then misinterpreted what you meant, sorry.
  9. public function loadPlugins($loadPlugins = null){ if(is_string($loadPlugins)){ $loadPlugins = explode(",", $loadPlugins); } $ini = $this->allpluginSettings(); if($loadPlugins == null){ foreach($ini as $sectionClass => $section){ require_once $this->location."/plugins/".$section['root']."/".$section['fileName']; $this->$section['instanceName'] = new $sectionClass(); $this->loadedFiles['plugins'][$section['root']]['path'][] = $this->location."/plugins/".$section['root']."/".$section['fileName']; $this->loadedFiles['plugins'][$section['root']]['files'][] = $section['fileName']; } } } This code, while an initial draft, isn't reusable nor properly tested: 1. You assume that any passed string is CSV 2. Once $loadPlugins != NULL you don't use it anywhere besides explode() it when it's a string which in turn isn't used anywhere. 3. $this->allpluginSettings() is called while the returned value is only used when $loadPlugins == NULL 4. Files are loaded through the require_once mechanism instead of a generic loader class 5. It's assumed the require_once will ALWAYS point to a file, and it will ALWAYS contain a class, so that $this->$section['instanceName'] = new $sectionClass(); never fails. 6. Exceptions/Error's aren't caught. 7. Using deep nesting $this->loadedFiles['plugins'][$section['root']]['files'] instead of using an object to represent the data structure. $myClass->example->someMethod(); still has the problem of no type-hinting unless you specify phpDoc @property comments on the class but since you are aiming for a plugin architecture this is not an option. No type-hinting is not only an IDE problem, it will also be hard for beginners to actually be able to understand why tutorials tell them stuff like: $o = new SomeObject(); while your framework loads it on-the-fly under a different name. If you want to teach beginners something, teach them how to program OO properly instead of showing them magic tricks. MyCoolFramework::create('User')->username('ignace')->password('foobarbaz')->authenticateSession()->setProfileAvatar(new Avatar('bar.png'))->save(); May look cool, but programming isn't about creating giant one-liners.
  10. @mikosiko Sharing addresses is not an option in this case, since: Assume I life on SesameStreet 7 with other students and 3 students are a customer: SesameStreet 7 | Student #1 SesameStreet 7 | Student #2 SesameStreet 7 | Student #3 Now Student #1 moves to Maryland 10 since only one record exists for SesameStreet 7 all are updated to Maryland 10: Maryland 10 | Student #1 Maryland 10 | Student #2 Maryland 10 | Student #3 One UPDATE just messed up your entire DB. I could even start adding addresses and then change them to my current address, now all your shipments are send to my home address (while I didn't pay for any of them).
  11. You can't serve the entire market (from beginner to advanced). Advanced users for example require functionality that reaches far beyond what beginners will ever need (ORM, DBAL, SOAP Client/Server, ..). Advanced users will also most likely use an IDE with type hinting of which it can't benefit if a large portion of your code is hidden behind magic methods like __call(), __set() and __get(). Both Symfony as CodeIgniter (Zend for it's action and view helpers) use this approach which I find annoying since I don't get a nice listing of available methods/properties.
  12. A user can have multiple addresses (home, work, ..). And multiple users can have the same address (colleagues, family members, students in the same house, ..). But you don't want to share addresses among users because when one edits his address, your packages may end up with the wrong customer. The relation therefor is: User (user_id, ..) Address (address_id, user_id, ..) You don't need the bridge table because each address is unique for each customer even if multiple customers live on the same address.
  13. ~setWindowStatus\('(.*)'\)~ Will give you the text between the parentheses. If you are using SimpleXML you would do something like: preg_match('~setWindowStatus\('(.*)'\)~', $e->attributes()->onmouseover, $matches); // [1] => Lurkers, show your face
  14. We need some database information here, like do you have a field like PaulRyan suggests? One that keeps record on when they registered and when they activated? If you have then you can select all users like: "Now I need to send a follow up “Thank You” email 1 day after people have authenticated themselves" SELECT * FROM users WHERE activated_on = CURRENT_DATE - INTERVAL 1 DAY ".. and another email 1 week later with a basic survey regarding satisfaction so far." SELECT * FROM users WHERE activated_on = CURRENT_DATE - INTERVAL 1 WEEK @PaulRyan SELECT email,name FROM users WHERE activated = 'No' AND activation_time < $dayAgo That will select everyone with activated = 'No' regardless whether that was yesterday or last year.
  15. Looks good! I like it!
  16. I am running the same config. By default every account has no password. To set a password for an account you must do it through MySQL. Download and install HeidiSQL http://www.heidisql.com/ After installation, run it! You'll get the session manager, click New and give it a name (localhost for example) fill in 127.0.0.1 for the Hostname and root for the User, press Open. Click Tools, User Manager. In this dialog you can effectively manage the users on your MySQL install. Add a new user, give it a password and the necessary privileges and press Save. Enter the new username and password in the PMA config.
  17. You need to store it using sessions, so the value persists for the duration of the game. session_start(); // MUST be at the top of your script if(!isset($_SESSION['increment'])) $_SESSION['increment'] = 1; echo $_SESSION['increment']++; If you run this script you'll see the value increment every time you refresh the page. The value of 'increment' is persisted between requests.
  18. QuickOldCar you scare me! return "www"; EXIT; You do realise that EXIT; will never be executed, do you? $url = mysql_real_escape_string($_GET['url']); This will actually put FALSE into $url when it can't establish a MySQL connection (when mysql_connect() with zero parameters fails). You also don't need to call it since you don't actually store the value in MySQL. $parsedUrl[host] ? $parsedUrl[host] : array_shift(explode('/', $parsedUrl[path], 2)); No quotes around string indexes? Always place your functions at the bottom of your scripts so that it remains readable and understandable.
  19. ServerGrove? Also hosts Symfony
  20. We have tried to hand-code a text-correcting script, but it made it no further then the early beta's, never a real release candidate. But since you are now volunteering, we'll give you a nice shiny button below your name and the option to edit/correct/solve topics/posts (which is only possible when you are a moderator or higher on these forums). Contact Daniel0 and he'll provide you with further instructions on how to gain the new title.
  21. You have done no indexing, you just showed us your table schema. But yes, the schema is correct. Although you shouldn't mention that it's a table (User_type_table), it's obvious.
  22. Answers differ depending on your background. Your first concern should be performance. No matter how small/big your project, people won't tolerate a SLOW website. Often your website is SLOW due to bad or non-existent index definitions. Learn how to normalize your DB, and how you define proper indexes. Doing so, will save you lots of money down the road. Hardware-driven optimization is costly. 1) Keep it all in one DB, but keep in mind when writing your code that some tables may be switched to a different DB 2) Using an extra column to store the user_type is a well-known technique. The user_types themselves are best kept in a separate table and referenced using a foreign key to the users table.
  23. I agree with MrAdam, even if it's just for doing something like this: Array.prototype.inArray = function(value) { // }; Array.prototype.forEach = function(callback) { // }; var a = ['a', 'b', 'c']; alert(a.inArray('c')); var d = a.forEach(function(k, v) { return k+v; });
  24. Now you made me curious, link?
×
×
  • 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.