コード例 #1
0
ファイル: page-tutors.php プロジェクト: Kaytal/bowie-tutoring
get_header(); ?>

	<div id="primary" class="content-area">
		<main id="main" class="site-main" role="main">
			<?php if (getFaculty() != '' ) : ?>
			<div class="row">
				<div class="entry-content col-sm-12">
					<header>
						<h1 class="header-2">Our Faculty</h1>
					</header>
				</div>
			</div>
			<div class="tutors">
				<?php $i=0; ?>
				<?php $d = count(getFaculty()); ?>
				<?php foreach (getFaculty() as $faculty ) : ?>
					<?php if (($i % 3) == 0) echo '</div><div class="tutors">' ?>
					<figure class="col-sm-4 tutor">
							<?php if (facultyImage($faculty->ID) == '') : ?>
								<img src="<?php echo get_template_directory_uri(); ?>/img/BowiePlaceholder.jpg" class="img-responsive img-center" alt="Placeholder Image">
							<?php else : ?>
								<?php echo facultyImage($faculty->ID) ?>
							<?php endif ?>
						<figcaption>
							<h1 class="figure-header"><?php echo $faculty->post_title ?></h1>
							<h2 class="figure-sub-header"><?php echo facultyPosition($faculty->ID) ?></h2>
							<?php if (facultyInfo($faculty->ID) != '' ) : ?><p><?php echo facultyInfo($faculty->ID) ?></p><?php endif ?>
						</figcaption>
					</figure>
					<?php $i++ ?>
				<?php endforeach ?>
コード例 #2
0
ファイル: hello.php プロジェクト: Virssagon/vagrant-silex
for ($i = 0; $i < 10; $i++) {
    if ($i % 2 == 0) {
        echo $i . " is even <br>";
    } else {
        echo $i . " is odd <br>";
    }
}
echo "<hr>";
$capital = array("Germany" => "Berlin", "France" => "Paris", "Belgium" => "Brussels");
foreach ($capital as $key => $value) {
    echo "The capital of {$key} is " . $value . "<br>";
}
echo "<br>";
echo "<hr>";
echo "<hr>";
echo "<hr>";
echo "<hr>";
function getFaculty($intN)
{
    if ($intN <= 1) {
        return 1;
    }
    for ($intFaculty = 1; $intN > 1; --$intN) {
        $intFaculty *= $intN;
    }
    return $intFaculty;
}
$limit = $_GET["limit"];
for ($i = 0; $i <= $limit; $i++) {
    echo $i . "! = " . getFaculty($i) . "<br/>";
}