CS174
Chris Pollett
Feb 22, 2016
Last week, we were talking about various properties of a tag that can be set using cascading style sheets. The last thing we covered was how to set the background-image of an element (I will tend to use element and tag interchangeably). Today, let's start by considering how to position elements on the screen using CSS...
<style type="text/css"> p.first {position: absolute; top:1in; left:2in;} p.second {position: relative; left:-1in;} </style> <p class="first">displays one inch down two inches from left of top of screen</p> <p class="second">displays 1inch to the left of where the first paragraph finished</p>
<input type="text" name="fname" accesskey="f" />
php name_of_script.php #runs name_of_script.php php -a # run in enter interactive mode. will get a prompt... php > echo "hello world"; hello world php > quit cd ~/public_html php -S localhost:8000 #starts built-in web server on port 8000 # using current dir as document root
short_open_tag = Onso that you can escape to a PHP script using <? rather than <?php
;error_reporting = E_ALL & ~E_NOTICEand uncomment it, restart Apache
Which of the following statements is true?
$bob = 6; echo "Bob=$bob"; // outputs Bob=6 echo 'Bob=$bob'; // outputs Bob=$bob
<p> A paragraph. Let's hop into interpretive mode: <?php print "hi there"; ?> back to copy mode </p>
$a = "hello"; //Heredocs $str = <<<EOD This string that lives on multiple lines uses heredocs syntax. $a interpolation happens EOD; echo $str; //Nowdocs $str2 = <<<'EOD2' $a interpolation doesn't happens EOD2; echo $str2;
<?php ob_start(); ?> <p>Hello World</p> <?php $out = ob_get_clean(); $out = strtolower($out); echo $out;