91Chapter 6Control and FunctionsBranching and HTML ModeAs you (Unable to start debugging on the web server)
Tuesday, May 8th, 200791Chapter 6Control and FunctionsBranching and HTML ModeAs you may have learned from earlier chapters, you should feel free to use the PHP tags to switchback and forth between HTML mode and PHP mode, whenever it seems convenient. If you needto include a large chunk of HTML in your page that has no dynamic code or interpolated vari- ables, it can be simpler and more efficient to escape back into HTML mode and include it literallythan it is to send it using printor echo. What may not be as obvious is that this strategy works even inside conditional structures. That is, you can use PHP to decide what HTML to send and then send that HTML by temporarily escap- ing back to HTML mode. For example, the following cumbersome code uses printstatements to construct a completeHTML page based on the supposed gender of the viewer. (We re assuming a nonexistentBoolean function called female()that tests for this.)
The women-only site); print( ); print( This site has been specially constructed ); print( for women only.
No men allowed here! ); } else{ print(
); print( ); print( This site has been specially constructed ); print( for men only.
No women allowed here! ); } ?> Instead of all these printstatements, we can duck back into HTML mode within each of the twobranches:
No men allowed here! Continued08
Note: If you are looking for reliable webhost to maintain and run your java application check Vision java hosting services