![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
ignace
Moderators-
Posts
6,457 -
Joined
-
Last visited
-
Days Won
26
Everything posted by ignace
-
How to use a method across different PHP files(classes)
ignace replied to JongMin's topic in PHP Coding Help
Years of experience. -
How to use a method across different PHP files(classes)
ignace replied to JongMin's topic in PHP Coding Help
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(); } } -
The post has guaranteed me that either you, your children, or your grandchildren will receive it. The post always deliver.
-
I filled it in, and I am a millionaire now! Enjoying the good life.
-
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.
-
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.
-
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.
-
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
-
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/
-
How would you approach this? (PHP PBP Engine Advice)
ignace replied to woj56k's topic in Application Design
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. -
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.
-
You can try demos of divers existing e-commerce systems at http://www.opensourcecms.com/scripts/show.php?pagenumber=1
-
// 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"; }
-
If a string contains "NOT word" how to replace it with "-word"?
ignace replied to the5thace's topic in PHP Coding Help
Hers??? -
If a string contains "NOT word" how to replace it with "-word"?
ignace replied to the5thace's topic in PHP Coding Help
preg_replace('/ not /i', ' -', $subject); preg_replace('/\\bnot\\b /i', '-', $subject); -
I always said to my colleagues I would nuke it. So where do I sign up as a new owner?
-
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.
-
Show us your table structure from PhpMyAdmin. And what timezone is your MySQL server in?
-
Design Pattern Definition: I would say it qualifies.
-
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.
-
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
-
Kevin already mentioned it, you need delegation, more particular, the Decorator pattern. interface FormInterface { public function input($value, $type = 'text'); } abstract class FormDecorator implements FormInterface { protected $form; public function __construct(FormInterface $form) { $this->form = $form; } } class BootstrapFormDecorator extends FormDecorator { public function input($value, $type = 'text') { return '<bootstrap-here>' . $this->form->input($value, $type) . '</bootstrap-here>'; } } class Form implements FormInterface { public function input($value, $type = 'text') { return "<input type=\"$type\" value=\"$value\">"; } } $form = new BootstrapFormDecorator(new Form); echo $form->input('foo');
-
php books vs understanding open source scripts
ignace replied to phpboy07's topic in PHP Coding Help
You can always use a text-2-speech program/device if you like the lines to be spoken instead of having to read them. -
function within a function within a function wrapped in a puzzle...
ignace replied to anoveskey's topic in PHP Coding Help
5 is correct. The last executed statement reads as: console.log(fn(5) => { y=3 + b=2 + 5 }); y is a reference inside the function and b has the local value 2 from x. -
Ask your question on the forum so everyone on here can benefit/contribute. Depending on how well your question is formed, you will get more/better feedback then you would from one individual. I know why you feel a need for a human source (though I want to remind you that we are human too you know, even when our intellectual reasoning may be at an astronomical level). I do too sometimes want a human source, but I would need $3,000 to spare to hire Martin Fowler for a day So, if you still want private consultation I bet a few good programmers on here can give you that at $80+ per hour. Makes you appreciate the free advice you get on here, doesn't it? If you have experience in programming, or if you are still learning to program. You'll have plenty of time to get to know the inner workings of programming while you are planning your game, the story, it's characters, the graphics/layout, the mechanics, the items, the factions, .. write it all down, refine, refine, .. By the time you have a good idea of how your game will work/behave you will be a good programmer by then