HTML and CSS Reference
In-Depth Information
Depending on the proper server configuration, the PHP code should be parsed, and the output in Listing 6-50
will be sent to the browser.
Listing 6-50. The Output with Parsed PHP
<!DOCTYPE html>
<html xmlns=" http://www.w3.org/1999/xhtml " xml:lang="en" lang="en">
<head>
<title>Hello World in PHP</title>
<meta charset="UTF-8" />
</head>
<body>
<p>Hello World!</p>
</body>
</html>
The resulting markup validates as XHTML5. To make the markup easier to understand, the structural elements
and additional contents were omitted.
PHP in External Files
The typical file extensions of external PHP files are .php , .phtml , .php5 , and .phps . External PHP files usually contain
the PHP code between the opening and closing delimiters. In other words, they start with <?php and end with ?> .
However, many PHP files, such as the ones used for settings, do not necessarily have a closing delimiter.
The include command can be used to insert the content of a specified external PHP file into the markup
(Listing 6-51).
Listing 6-51. Embedding a PHP File
<?php include("copyright.php"); ?>
An external PHP file might contain PHP code, markup, or a combination of the two.
it is a common practice to collect the markup fragment of common—frequently repeated—web page contents,
such as menus and legal information, and embed them from an external php file. this approach eliminates the
redundancy of common scripting requirements of a site.
Tip
Python
Python is a general-purpose high-level programming language [56]. Python, similar to other dynamic languages,
is often used as a scripting language as well. Multiple programming paradigms are supported by Python. Although
Python is mainly object-oriented, it also involves functional programming styles. The capabilities of the language
can be extended by third-party tools; for example, Python code can be provided as stand-alone executables. Python
interpreters are available for a variety of operating systems, which makes Python a cross-platform language.
 
 
Search WWH ::




Custom Search