本文整理汇总了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>';