Schweitzer Fachinformationen
Wenn es um professionelles Wissen geht, ist Schweitzer Fachinformationen wegweisend. Kunden aus Recht und Beratung sowie Unternehmen, öffentliche Verwaltungen und Bibliotheken erhalten komplette Lösungen zum Beschaffen, Verwalten und Nutzen von digitalen und gedruckten Medien.
Explore the engine that drives the internet
It takes a powerful suite of technologies to drive the most-visited websites in the world. PHP, mySQL, JavaScript, and other web-building languages serve as the foundation for application development and programming projects at all levels of the web.
Dig into this all-in-one book to get a grasp on these in-demand skills, and figure out how to apply them to become a professional web builder. You'll get valuable information from seven handy books covering the pieces of web programming, HTML5 & CSS3, JavaScript, PHP, MySQL, creating object-oriented programs, and using PHP frameworks.
Richard Blum has more than 30 years of experience as a systems administrator and programmer. He teaches online courses in PHP, JavaScript, HTML5, and CSS3 programming, and authored the latest edition of Linux For Dummies.
Introduction 1
About This Book 1
Foolish Assumptions 2
Icons Used in This Book 3
Beyond the Book 3
Where to Go from Here 3
Book 1: Getting Started With Web Programming 5
Chapter 1: Examining the Pieces of Web Programming 7
Creating a Simple Web Page 7
Creating a Dynamic Web Page 17
Storing Content 25
Chapter 2: Using a Web Server 27
Recognizing What's Required 27
Considering Your Server Options 31
Tweaking the Servers 41
Chapter 3: Building a Development Environment 51
Knowing Which Tools to Avoid 51
Working with the Right Tools 53
Book 2: Html5 and Css3 71
Chapter 1: The Basics of HTML5 73
Diving into Document Structure 73
Looking at the Basic HTML5 Elements 81
Marking Your Text 85
Working with Characters 90
Making a List (And Checking It Twice) 92
Building Tables 96
Chapter 2: The Basics of CSS3 103
Understanding Styles 103
Styling Text 112
Working with the Box Model 119
Styling Tables 121
Positioning Elements 125
Chapter 3: HTML5 Forms 135
Understanding HTML5 Forms 135
Using Input Fields 138
Adding a Text Area 146
Using Drop-Down Lists 147
Enhancing HTML5 Forms 149
Using HTML5 Data Validation 154
Chapter 4: Advanced CSS3 157
Rounding Your Corners 157
Using Border Images 159
Looking at the CSS3 Colors 162
Playing with Color Gradients 164
Adding Shadows 166
Creating Fonts 168
Handling Media Queries 171
Chapter 5: HTML5 and Multimedia 177
Working with Images 177
Playing Audio 185
Watching Videos 190
Getting Help from Streamers 194
Book 3: Javascript 195
Chapter 1: Introducing JavaScript 197
Knowing Why You Should Use JavaScript 197
Seeing Where to Put Your JavaScript Code 199
The Basics of JavaScript 203
Controlling Program Flow 209
Working with Functions 220
Chapter 2: Advanced JavaScript Coding 223
Understanding the Document Object Model 223
Finding Your Elements 233
Working with Document Object Model Form Data 238
Chapter 3: Using jQuery 243
Loading the jQuery Library 244
Using jQuery Functions 246
Finding Elements 247
Replacing Data 250
Changing Styles 254
Changing the Document Object Model 259
Playing with Animation 261
Chapter 4: Reacting to Events with JavaScript and jQuery 263
Understanding Events 263
Focusing on JavaScript and Events 267
Looking at jQuery and Events 276
Chapter 5: Troubleshooting JavaScript Programs 283
Identifying Errors 283
Working with Browser Developer Tools 285
Working Around Errors 295
Book 4: PHP 301
Chapter 1: Understanding PHP Basics 303
Seeing the Benefits of PHP 303
Understanding How to Use PHP 305
Working with PHP Variables 310
Using PHP Operators 317
Including Files 320
Chapter 2: PHP Flow Control 325
Using Logic Control 325
Looping 331
Building Your Own Functions 336
Working with Event-Driven PHP 339
Chapter 3: PHP Libraries 349
How PHP Uses Libraries 349
Text Functions 354
Math Functions 361
Date and Time Functions 365
Image-Handling Functions 369
Chapter 4: Considering PHP Security 375
Exploring PHP Vulnerabilities 375
PHP Vulnerability Solutions 384
Chapter 5: Object-Oriented PHP Programming 395
Understanding the Basics of Object-Oriented Programming 395
Using Magic Class Methods 401
Loading Classes 409
Extending Classes 414
Chapter 6: Sessions and Carts 419
Storing Persistent Data 419
PHP and Cookies 424
PHP and Sessions 430
Shopping Carts 436
Book 5: MYSQL 443
Chapter 1: Introducing MySQL 445
Seeing the Purpose of a Database 445
Presenting MySQL 454
Advanced MySQL Features 458
Chapter 2: Administering MySQL 465
MySQL Administration Tools 465
Managing User Accounts 477
Chapter 3: Designing and Building a Database 489
Managing Your Data 489
Creating Databases 492
Building Tables 500
Chapter 4: Using the Database 513
Working with Data 513
Searching for Data 524
Playing It Safe with Data 531
Chapter 5: Communicating with the Database from PHP Scripts 541
Database Support in PHP 541
Using the mysqli Library 543
Putting It All Together 554
Book 6: Creating Object-Oriented Programs 561
Chapter 1: Designing an Object-Oriented Application 563
Determining Application Requirements 563
Creating the Application Database 565
Designing the Application Objects 571
Designing the Application Layout 579
Coding the Website Layout 582
Chapter 2: Implementing an Object-Oriented Application 593
Working with Events 593
Bidder Object Events 595
Item Object Events 605
Logging Out of a Web Application 614
Testing Web Applications 616
Chapter 3: Using AJAX 619
Getting to Know AJAX 619
Communicating Using JavaScript 621
Using the jQuery AJAX Library 629
Transferring Data in AJAX 635
Modifying the AuctionHelper Application 643
Chapter 4: Extending WordPress 651
Getting Acquainted with WordPress 651
Installing WordPress 655
Examining the Dashboard 662
Using WordPress 664
Exploring the World of Plugins 669
Creating Your Own Widget 674
Book 7: Using PHP Frameworks 681
Chapter 1: The MVC Method 683
Getting Acquainted with MVC 683
Comparing MVC to Other Web Models 691
Seeing How MVC Fits into N-Tier Theory 693
Implementing MVC 694
Chapter 2: Selecting a Framework 695
Getting to Know PHP Frameworks 695
Knowing Why You Should Use a Framework 702
Focusing on Popular PHP Frameworks 704
Looking At Micro Frameworks 710
Chapter 3: Creating an Application Using Frameworks 715
Building the Template 715
Creating an Application Scaffold 721
Modifying the Application Scaffold 725
Index 735
Chapter 1
IN THIS CHAPTER
Understanding how simple web pages work
Incorporating programming into your web page
Storing content in a database
At first, diving into web programming can be somewhat overwhelming. You need to know all kinds of things in order to build a web application that not only looks enticing but also works correctly. The trick to learning web programming is to pull the individual pieces apart and tackle them one at a time.
This chapter gets you started on your web design journey by examining the different pieces involved in creating a simple web page. Then it kicks things up a notch and walks you through dynamic web pages. And finally, the chapter ends by explaining how to store your content for use on the web.
Before you can run a marathon, you need to learn how to walk. Likewise, before you can create a fancy website, you need to know the basics of how web pages work.
Nowadays, sharing documents on the Internet is easy, but it wasn't always that way. Back in the early days of the Internet, documents were often created using proprietary word-processing packages and had to be downloaded using the cumbersome File Transfer Protocol (FTP). To retrieve a document, you had to know exactly what server contained the document, you had to know where it was stored on the server, and you had to be able to log into the server. After all that, you still needed to have the correct word-processing software on your computer to view the document. As you can imagine, it wasn't long before a new way of sharing content was required.
To get to where we are today, several different technologies had to be developed:
This section describes the technology that made viewing documents on the Internet work the way it does today.
In 1989, Tim Berners-Lee developed a method of interconnecting documents to make sharing research information on the Internet easier. His creation, the World Wide Web, defined a method for linking documents together in a web structure, so that a researcher could follow the path between related documents, no matter where they were located in the world. Clicking text in one document took you to another document automatically, without your having to manually find and download the related document.
The method Berners-Lee developed for linking documents is called hypertext. Hypertext embeds links that are hidden from view in the document, and directs the software being used to view the document (known as the web browser) to retrieve the referenced document. With hypertext, you just click the link, and the software (the web browser) does all the work of finding and retrieving the related document for you.
Because the document-viewing software does all the hard work, a new type of software had to be developed that was more than just a document viewer. That's where web browsers came into existence. Web browsers display a document on a computer screen and respond to the reader clicking hypertext links to retrieve other specified documents.
To implement hypertext in documents, Berners-Lee had to utilize a text-based document-formatting system. Fortunately for him, a lot of work had already been done on that.
Markup languages were developed to replace proprietary word-processing packages with a standard way of formatting documents so that they could be read by any type of document viewer on any type of device. This goal is accomplished by embedding tags in the text. Each tag indicates a formatting feature, such as headings, bold or italic text, or special margins. What made markup languages different from word-processing packages is that these tags were common text codes instead of proprietary codes, making it generic enough that any device could read and process them.
The first popular markup language was the Generalized Markup Language (GML), developed by IBM in the 1960s. The International Organization for Standardization (ISO) took up the challenge of creating markup languages and produced the Standard Generalized Markup Language (SGML), mainly based on GML, in the 1980s. However, because SGML was developed to cover all types of document formatting on all types of devices, it's extremely complex and it wasn't readily adapted.
Berners-Lee used the ideas developed in SGML to create a simplified markup language that could support his hypertext idea. He called it Hypertext Markup Language (HTML). HTML uses the same concept of tags that SGML uses, but it defines fewer of them, making it easier to implement in software.
An example of an HTML tag is <h1>. You use this tag to define text that's used as a page heading. Just surround the text with an opening <h1> tag, and a corresponding closing </h1> tag, like this:
<h1>
</h1>
<h1>This is my heading</h1>
When the browser gets to the <h1> tag, it knows to format the text embedded in the opening and closing tags using a different style of formatting, such as a larger font or a bold typeface.
To define a hypertext link to another document, you use the <a> tag:
<a>
<a href="anotherdoc.html">Click here for more info</a>
When the reader clicks the Click here for more info text, the browser automatically tries to retrieve the document specified in the <a> tag. That document can be on the same server or on another server anywhere on the Internet.
HTML development has seen quite a few changes since Berners-Lee created it and turned it over to the World Wide Web Consortium (W3C) to maintain. Table 1-1 shows the path the language has taken.
TABLE 1-1 HTML Versions
Version
Description
HTML 1.0
Formally released in 1989 as the first public version of HTML
HTML 2.0
Released in 1995 to add interactive elements
HTML 3.0
Released in 1996 but never widely adopted
HTML 3.2
Released in 1997, adding support for tables
HTML 4.01
Released in 1999, widely adopted, and remains an often-used standard
XHTML 1.0
Released in 2001, standardizing HTML around the XML document format
XHTML 1.1
Released in 2002, making updates and corrections to XHTML 1.1
HTML 5.0
Released in 2014, adding multimedia features
The HTML version 4.01 standard was the backbone of websites for many years, and it's still used by many websites today. However, HTML version 5.0 (called HTML5 for short) is the future of web development. It provides additional features for embedding multimedia content in web pages without the need for proprietary software plug-ins (such as Adobe Flash Player). Because multimedia is taking over the world (just ask YouTube), HTML5 has grown in popularity. This book focuses on HTML5; all the code included in this book use that standard.
Besides a document-formatting standard, Berners-Lee also developed a method of easily retrieving the HTML documents in a client-server environment. A web server software package runs in the background on a server, listening for connection requests from web clients (the browser). The browser sends requests to retrieve HTML documents from the server. The request can be sent anonymously (without using a login username), or the browser can send a username and password or certificate to identify the requestor.
These requests and responses are defined in the Hypertext Transfer Protocol (HTTP) standard. HTTP defines a set of requests the client can send to the server and a set of responses the server uses to reply back to the client.
This section walks you through the basics of how web servers and web clients use HTTP to interact with each other to move web pages across the Internet.
The web client sends requests to the web server on a standard network communication channel (known as TCP port 80), which is defined as the standard for HTTP communication. HTTP uses standard text requests sent to the server, either requesting information from the server or sending information to the server. Table 1-2 shows the basic HTTP client requests available.
TABLE 1-2 HTTP Client...
Dateiformat: ePUBKopierschutz: Adobe-DRM (Digital Rights Management)
Systemvoraussetzungen:
Das Dateiformat ePUB ist sehr gut für Romane und Sachbücher geeignet – also für „fließenden” Text ohne komplexes Layout. Bei E-Readern oder Smartphones passt sich der Zeilen- und Seitenumbruch automatisch den kleinen Displays an. Mit Adobe-DRM wird hier ein „harter” Kopierschutz verwendet. Wenn die notwendigen Voraussetzungen nicht vorliegen, können Sie das E-Book leider nicht öffnen. Daher müssen Sie bereits vor dem Download Ihre Lese-Hardware vorbereiten.Bitte beachten Sie: Wir empfehlen Ihnen unbedingt nach Installation der Lese-Software diese mit Ihrer persönlichen Adobe-ID zu autorisieren!
Weitere Informationen finden Sie in unserer E-Book Hilfe.