Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by ignace

  1. Yes. It separates the 3 responsibilities. Though a controller should not execute queries as only your model should be capable to do this. Also your update_save function should receive it's data from the controller and not use $_POST or $_GET internally since only your controller knows about $_POST and $_GET. The controller should be a firewall of some sort, between the client and your controller HTTP exists, but the model should be agnostic of HTTP. HTTP CALLS { client }<---->{ controller}---->{ model } The advantage here is that you can change HTTP to for example CLI or SOAP or whatever without having to change the underlying model. Since $_POST, $_GET, $_COOKIE, $_SESSION are part of HTTP it's therefor that your model should be agnostic of these variables. A model should not issue redirects since redirect's are the responsibility of the controller.
  2. A template and a view are the same thing. In MVC the View is the part of the application that displays the results of a user's action and the application's processing. How you make up that View is entirely up to you. MVC is an idea and thus not bound to any technical implementation's, the same applies to views. For example: // the file is the controller (binds model and view) if ($_POST) { // mail is part of our model mail('foo@bar.bat', $_POST['subject'], $_POST['message']); // thank-you.html is part of our views include 'thank-you.html'; exit; } // contact.html is part of our views include 'contact.html'; // all concerns have been separatedThis is an MVC implementation.
  3. When posting code, mind that this is a public forum. And any sensitive data is for the world to see. I removed your db credentials, but I advice you to change them.
  4. MUAHAHA! MORE MINIONS! MORE MINIONS!!! uhm.. I meant congrats on the promotion.
  5. Don't use inheritance. Test is not a Common. Instead pass it through the constructor or a setter. class Test { private $common; public function __construct(Common $common) { $common->initSomething(); } }
  6. The post has guaranteed me that either you, your children, or your grandchildren will receive it. The post always deliver.
  7. I filled it in, and I am a millionaire now! Enjoying the good life.
  8. Nobody is going to write a script for you for free. Head on over to the freelance section and post there. Interested parties will PM you with their rates. If you have a specific question ask, but do not expect people to write it for you.
  9. CodeIgniter is dead, Ellislab is looking for a new owner: http://ellislab.com/blog/entry/ellislab-seeking-new-owner-for-codeigniter Try CakePHP, Laravel, Symfony, or Zend.
  10. 1 + 2 = 3 each number in this equation is a variable. Find the equation that alters the value of the variable to the requested value. 1 + 2 = 3 thus is 3 + 5 and it would assign 8 to variable 3. The text is confusing because they use numbers as variable names, but if you read it literally, it makes sense. The first question asks to find the equation that makes variable 1 contain value 12 which is done by equation 2 (2 + 3 = 1 <=> 5 + 7 = 12). The second question to get 15 in variable 3 is done by combining (sequence) equations 5 and 3.
  11. 1=3, 2=5, 3=7 1) 1 + 2 = 3 <=> 3 + 5 = 8 2) 2 + 3 = 1 <=> 5 + 7 = 12 => 1st op. (1) 1=12 3) 3 + 2 = 3 <=> 7 + 5 = 12 => 2nd op. (2) 3=15 4) 2 + 1 = 2 <=> 5 + 3 = 8 5) 2 + 2 = 3 <=> 5 + 5 = 10 => 2nd op. (1) 3=10 6) 2 + 3 = 3 <=> 5 + 7 = 12
  12. jQuery UI has a calendar widget: http://jqueryui.com/datepicker/#inline It has an option to which you provide a function that tells whether it's possible to select that day. http://api.jqueryui.com/datepicker/#option-beforeShowDay jQuery UI has custom themes (under Gallery) or you can roll your own: http://jqueryui.com/themeroller/
  13. If you had read the ToS, to which you agreed when you signed up, you would know that any request for delete is ignored/declined.
  14. Sign up at github.com, create a repository, both install git from git-scm.com, and both clone it to their hard-drives. Either makes changes and pushes this to the github repo, the other one pulls these changes and resolves any conflicts (communication is important here, so you don't throw someone else's work away) during the merge. To make this merging as smooth as possible you better look into an IDE with proper merging tools (preferably 3 way). At my work a few use lightweight editors like Coda, and Sublime Text, but neither comes with proper merging tools. Therefor you should look to either NetBeans (free), or PhpStorm (89 EUR), or if you got cash to burn Zend (149 EUR). Somewhere on this forum there is a thread about IDE's it might be worth a look there.
  15. You can try demos of divers existing e-commerce systems at http://www.opensourcecms.com/scripts/show.php?pagenumber=1
  16. // count down from 30 to 0 for ($i = 30; $i >= 0; $i = $i - 1 /* long version to better understand what happens <=> $i -= 1 <=> $i-- */) { echo $i, '<br>', "\n"; } // count up from 0 to 30 for ($i = 0; $i <= 30; $i = $i + 1 /* long version to better understand what happens <=> $i += 1 <=> $i++ */) { echo $i, '<br>', "\n"; }
  17. preg_replace('/ not /i', ' -', $subject); preg_replace('/\\bnot\\b /i', '-', $subject);
  18. I always said to my colleagues I would nuke it. So where do I sign up as a new owner?
  19. The FormInterface is required so that you form and your formdecorator define the same methods/interface. Since you don't want to use the Formdecorator on it's own, but only allow it to decorate a form.
  20. Show us your table structure from PhpMyAdmin. And what timezone is your MySQL server in?
  21. Design Pattern Definition: I would say it qualifies.
  22. So pass it to the view? class MyController { private $db public function __construct(Database $db, SomeView $view) { $this->db = $db; $this->view = $view; } public function index() { $this->view->render('view', $this->db->getData()); } }MVC is not rocket-science, it's a simple pattern where you have 2 main actors: Model and View, for example a User object (Model) and the View that renders the form to edit the user's details. In an event-driven arch. the View would notify the Model of the changes (Observer pattern) the user made to the form and thus the Model's data. But since this is not possible due to the whole decoupled client/server thing the data is POST'ed back across HTTP but of course you can't call the Model directly since the Model does not know how to call itself therefor you need a 3rd actor to bind the Model and the View together, called the Controller. I hope this way it makes much more sense.
  23. The problem with that is that you will have to re-write your form every time you change framework. Your form never changes, an input remains an input so you should be able to re-use that code and decorate your form with the bootstrap css framework. The added benefit is that the interface you "talk" to is the same regardless wether you are using a plain form or a bootstrap form. Allowing you to even re-use your existing forms and changing them is as easy as: function get_form() { return new BootstrapForm(new SimpleForm); }to function get_form() { return new BlueprintForm(new SimpleForm); }And now all your existing forms on your website have been changed from bootstrap to blueprint. You can even go crazy and do something like: function get_form() { return new BootstrapForm(new BlueprintForm(new SimpleForm)); }If you are concerned about not enough flexibility you can always extend the FormInterface: interface FormInterface { public function input($name, $value, $type = 'text', $id = null, array $attrs = array()); public function textInput($name, $value, $id = null, array $attrs = array()); public function radioInput($name, $onOrOff = false, $id = null, array $attrs = array()); .. public function dropDown($name, array $options, $id = null, array $attrs = array()); .. }Also take a look at- http://framework.zend.com/manual/2.2/en/modules/zend.form.intro.html - and http://symfony.com/doc/current/book/forms.html
  • 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.