本文整理匯總了PHP中Banner::SetText方法的典型用法代碼示例。如果您正苦於以下問題:PHP Banner::SetText方法的具體用法?PHP Banner::SetText怎麽用?PHP Banner::SetText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Banner
的用法示例。
在下文中一共展示了Banner::SetText方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testBanner
public function testBanner()
{
$this->startCodeCoverage();
$banner = new Banner();
ob_start();
$result = $banner->SetText('banner');
$output = ob_get_contents();
ob_end_clean();
if ($result) {
$this->fail('SetText() should return false when ProjectId is -1');
return 1;
}
if (strpos($output, 'Banner::SetText(): no ProjectId specified') === false) {
$this->fail("'no ProjectId specified' not found from SetText()");
return 1;
}
//set a reasonable project id
$banner->SetProjectId(1);
//test insert
$banner->SetText('banner');
//test update
$banner->SetText('banner');
if ($banner->GetText() != 'banner') {
$this->fail("GetText() should have returned 'banner'.");
return 1;
}
$this->pass('Passed');
$this->stopCodeCoverage();
return 0;
}
示例2: while
$projects = pdo_query($sql);
while ($project_array = pdo_fetch_array($projects)) {
$xml .= '<availableproject>';
$xml .= add_XML_value('id', $project_array['id']);
$xml .= add_XML_value('name', $project_array['name']);
if ($project_array['id'] == $projectid) {
$xml .= add_XML_value('selected', '1');
}
$xml .= '</availableproject>';
}
$Banner = new Banner();
$Banner->SetProjectId($projectid);
// If submit has been pressed
@($updateMessage = $_POST['updateMessage']);
if (isset($updateMessage)) {
$Banner->SetText(htmlspecialchars(pdo_real_escape_string($_POST['message'])));
}
/* We start generating the XML here */
// List the available project
if ($projectid >= 0) {
$xml .= '<project>';
$xml .= add_XML_value('id', $Project->Id);
$xml .= add_XML_value('text', $Banner->GetText());
if ($projectid > 0) {
$xml .= add_XML_value('name', $Project->GetName());
$xml .= add_XML_value('name_encoded', urlencode($Project->GetName()));
}
$xml .= add_XML_value('id', $Project->Id);
$xml .= '</project>';
}
$xml .= '</cdash>';