我是文件制作者API的新手。我正在尝试构建一个缩略图页面,其中从数据库中提取的图像按行排列,但它们只是在一列中。理想情况下,它不是每行固定的数字,但会根据显示设置而改变。我做错了什么?
<?php
require_once 'fmview.php';
require_once 'FileMaker.php';
require_once 'error.php';
$cgi = new CGI();
$cgi->storeFile();
$userName = $cgi->get('userName');
$passWord = $cgi->get('passWord');
$databaseName = 'costumehistoricalcollection';
$hostName = '137.99.30.10';
$layoutName = 'Listing';
$fm = & new FileMaker($databaseName, $hostName, $userName, $passWord);
ExitOnError($fm);
$layoutList = $fm->listLayouts();
ExitOnError($layoutList);
class EmptyRecord {
function getRelatedSet($relationName) {
return array(new EmptyRecord());
}
function getField($field, $repetition = 0) {
}
function getRecordId() {
}
}
$record = new EmptyRecord();
$findCom = $fm->newFindAllCommand($layoutName);
$findCom -> addSortRule('Catalog_Number', 1, FILEMAKER_SORT_ASCEND);
$result = $findCom->execute();
ExitOnError($result);
$records = $result->getRecords();
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" media="screen" href="photo_black.css">
<title>
Virtual Historical Costume Museum
</title>
<script type = "text/javascript" src="client_libs/jQuery/jquery-1.10.1.min.js"></script>
<script type = "text/javascript">
//<![CDATA[
<!--hide from incompatible browsers
function switch_resulting_view(){
if (document.forms[0].action == "recordlist.php"){
document.forms[0].action = "thumbnaillist.php";
document.getElementById("theView").innerHTML = "THUMBNAIL VIEW";
}else{
document.forms[0].action = "recordlist.php";
document.getElementById("theView").innerHTML = "LIST VIEW";
}
}
</script>
<body>
<div id="wrapper"; style="width:100%">
<div id="container"; style="width:100%">
<!-- NEW NAV AND HEADER -->
<?php include("nav/header.html"); ?>
<!-- PAGE BODY -->
<!-- <div id="sidebar";style="float:left">
<p>
<ul>
<li>Home</li>
<li>About the archive</li>
<li>Explore our Collection</li>
<li>Our Staff</li>
<li>Donate</li>
<li>Exhibitions</li>
<li>Contact</li>
</ul>
<p>
</div> -->
<div id="content";>
<div>
<?php
$findCommand = $fm->newFindCommand("Listing");
$findCommand->addFindCriterion("Photo", "*");
$findCommand->addSortRule('Date CR', 1,FILEMAKER_SORT_ASCEND);
$result = $findCommand->execute();
if(FileMaker::isError($result)){
echo($result->getMessage());
return;
}
$records = $result->getRecords();
foreach ($records as $record){
$photo = $record->getField("Photo");
$thumbnail = $record->getField("Thumbnail");
/* $hist = $record->getField("History");
/* $desc = $record->getField("Description"); */
$cNum = $record->getField("Catalog_Number");
echo ("<tr>");
echo ("<td><a href = \"");
echo ($photo);
echo ("\">");
echo ("<img src= \" ");
echo ($thumbnail);
echo (" \"></a></td>");
echo ("<td><font color=\"white\">");
echo ($cNum);
echo ("<br><br><br>");
/* echo ($hist);
/* echo ($desc); */
echo ("</font></td>");
echo("</tr>");
};
?>
</div>
</div>
</div>
<?php include("nav/footer.html"); ?>
</div>
</body>
答案 0 :(得分:1)
HTML中存在错误 - 缺少属性名称。
而不是
<div id="wrapper";width:100%>
应该是
<div id="wrapper" style="width:100%">
下一个标签也一样