rob
Members-
Posts
143 -
Joined
-
Last visited
-
Days Won
16
rob last won the day on January 19 2013
rob had the most liked content!
rob's Achievements
Newbie (1/14)
53
Reputation
-
$dbValue = the value stored in the database. <select name="colours"> <option value="blue" <?php if(isset($dbValue) && $dbValue == "blue") echo "selected"; ?>>blue</option> </select> You can use the same principle to pre-populate radio buttons.
- 7 replies
-
- chapter 10.3
- edit
-
(and 1 more)
Tagged with:
-
For select (drop-down list) you can preset a selection using "selected": <select name="colours"> <option value="blue" selected>blue</option> </select> For radio buttons you can preset a value using "checked": <input type="radio" name="status" value="on" checked>On So you need to compare the value you have stored, against the value of each option and then include selected or checked in the html for that element.
- 7 replies
-
- chapter 10.3
- edit
-
(and 1 more)
Tagged with:
-
The first thing you need to do is place the instantiation of the SoapClient object within a try catch block. This will help you problem solve the issue you’re having with your script. There is a lot of information online about writing services using PHP. I have no idea where you are in terms of you level of PHP knowledge/learning and I could be doing you a huge disservice by stating get good at searching for information/tutorials online. I had a quick search on google and I got a huge number of useful resources for tutorials; sitepoint seems to have a pretty good 2 part series: creating web services using SOAP and PHP. However, services using SOAP kind of went out of favour back in the day and most developers use REST these days. Personally, I think it’s always good to work through Larry’s books, but after you’ve finished with SOAP I would recommend having a look at creating REST APIs using PHP. There is a tonne of information online.
-
Just in case anyone missed it: https://github.com/blog/1938-git-client-vulnerability-announced
-
Every coder should be striving to write the most legible code they can, for both themselves and others. Ask yourself how easily and quickly could you read and understand what the code does if you came back to it in 6 months. My view is, always use curly braces. Also, understand that projects often have their own code style rules. I have my own preferences but I’ve found myself having to write code differently because I wanted to contribute to certain open-source projects. I’d recommend having a look at PSR http://www.php-fig.org/psr/psr-1/ “Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live.” — Martin Golding
-
I'm having trouble understanding/linking the code example to the diagram and definition for the Factory Pattern. abstract class Shape { ... } class Rectangle extends Shape { ... } class Triangle extends Shape { ... } abstract class ShapeFactory { static function Create($type, array $sizes) { switch ($type) { case 'rectangle': return new Rectangle($sizes[0], $sizes[1]); break; case 'triangle': return new Triangle($sizes[0], $sizes[1], $sizes[2]); break; } } } $obj = ShapeFactory::Create($_GET['shape'], $_GET['dimensions']); Must be having an off day because I'm not seeing how the abstract factory class is being extended in the code example. I was unable to find any information in the book explaining the solid arrows or the term concrete, can anyone point me to the right pages, I must be going blind :/ Any help greatly appreciated. edit: ok I think I understand why there was confusion. The UML diagram used in the book is representative of the second reason/example given for using the factory pattern (where a base factory class is extended) but the code example references the first reason given for using a factory class and there is no UML diagram for this.
-
It's pretty straight forward to achieve. They're simply links with images instead of text. <a href="url_to_somewhere"><img src="icon.png"></a> There are lots of free social media icons available online, so unless you make your own it's just a matter of finding a free style that you like or fits with your overall design.
-
Activation
rob replied to uncfelt1147's topic in PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
I've used Twilio with both php and ruby - the api is insanely easy to use. There's some good info in the docs as well as many free tutorials on blogs etc. -
Or Curl, not sure it matters which method you use. This looks promising: https://github.com/KnpLabs/php-github-api The docs directory seems to have a pretty good list of examples If you share what you're trying to achieve I/we might be able to be a bit more helpful.
- 1 reply
-
- http
- httprequest
-
(and 1 more)
Tagged with: