本文整理汇总了PHP中Database_Result::next方法的典型用法代码示例。如果您正苦于以下问题:PHP Database_Result::next方法的具体用法?PHP Database_Result::next怎么用?PHP Database_Result::next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Database_Result
的用法示例。
在下文中一共展示了Database_Result::next方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchNext
/**
* Fetch the next result row and create the model
*
* @return boolean True if there was another row
*/
protected function fetchNext()
{
if ($this->objResult->next() == false) {
return false;
}
$strClass = $this->getModelClassFromTable($this->strTable);
$this->arrModels[$this->intIndex + 1] = new $strClass($this->objResult);
return true;
}
示例2: parseArticles
/**
* Parse one or more items and return them as array
* @param Database_Result
* @param boolean
* @return array
*/
protected function parseArticles(Database_Result $objArticles, $blnAddArchive=false)
{
if ($objArticles->numRows < 1)
{
return array();
}
global $objPage;
$this->import('String');
$arrArticles = array();
$limit = $objArticles->numRows;
$count = 0;
$imgSize = false;
// Override the default image size
if ($this->imgSize != '')
{
$size = deserialize($this->imgSize);
if ($size[0] > 0 || $size[1] > 0)
{
$imgSize = $this->imgSize;
}
}
while ($objArticles->next())
{
$objTemplate = new FrontendTemplate($this->news_template);
$objTemplate->setData($objArticles->row());
$objTemplate->count = ++$count;
$objTemplate->class = (($objArticles->cssClass != '') ? ' ' . $objArticles->cssClass : '') . (($count == 1) ? ' first' : '') . (($count == $limit) ? ' last' : '') . ((($count % 2) == 0) ? ' odd' : ' even');
$objTemplate->newsHeadline = $objArticles->headline;
$objTemplate->subHeadline = $objArticles->subheadline;
$objTemplate->hasSubHeadline = $objArticles->subheadline ? true : false;
$objTemplate->linkHeadline = $this->generateLink($objArticles->headline, $objArticles, $blnAddArchive);
$objTemplate->more = $this->generateLink($GLOBALS['TL_LANG']['MSC']['more'], $objArticles, $blnAddArchive, true);
$objTemplate->link = $this->generateNewsUrl($objArticles, $blnAddArchive);
$objTemplate->archive = $objArticles->archive;
// Clean the RTE output
if ($objArticles->teaser != '')
{
if ($objPage->outputFormat == 'xhtml')
{
$objArticles->teaser = $this->String->toXhtml($objArticles->teaser);
}
else
{
$objArticles->teaser = $this->String->toHtml5($objArticles->teaser);
}
$objTemplate->teaser = $this->String->encodeEmail($objArticles->teaser);
}
// Display the "read more" button for external/article links
if (($objArticles->source == 'external' || $objArticles->source == 'article') && $objArticles->text == '')
{
$objTemplate->text = true;
}
// Encode e-mail addresses
else
{
// Clean the RTE output
if ($objPage->outputFormat == 'xhtml')
{
$objArticles->text = $this->String->toXhtml($objArticles->text);
}
else
{
$objArticles->text = $this->String->toHtml5($objArticles->text);
}
$objTemplate->text = $this->String->encodeEmail($objArticles->text);
}
$arrMeta = $this->getMetaFields($objArticles);
// Add meta information
$objTemplate->date = $arrMeta['date'];
$objTemplate->hasMetaFields = !empty($arrMeta);
$objTemplate->numberOfComments = $arrMeta['ccount'];
$objTemplate->commentCount = $arrMeta['comments'];
$objTemplate->timestamp = $objArticles->date;
$objTemplate->author = $arrMeta['author'];
$objTemplate->datetime = date('Y-m-d\TH:i:sP', $objArticles->date);
$objTemplate->addImage = false;
// Add an image
if ($objArticles->addImage && is_file(TL_ROOT . '/' . $objArticles->singleSRC))
{
//.........这里部分代码省略.........
示例3: getRows
/**
* Get rows
*
* @param \Database_Result $objRecords
*
* @return array
*/
public function getRows($objRecords)
{
if (!$objRecords->numRows) {
return array();
}
$arrRows = array();
$objRecords->reset();
while ($objRecords->next()) {
$arrField = $objRecords->row();
foreach ($this->fields as $field) {
$arrField[$field] = Format::dcaValue($this->foreignTable, $field, $objRecords->{$field});
}
$arrRows[] = $arrField;
}
return $arrRows;
}
示例4: parseArticles
/**
* Parse one or more items and return them as array
*
* @param Database_Result $objArticles
* @param bool|Template $objTemplate
* @return array
*/
protected function parseArticles(Database_Result $objArticles, $objTemplate = false)
{
if ($objArticles->numRows < 1) {
return array();
}
global $objPage;
$this->import('String');
$this->import('News4wardHelper');
$arrArticles = array();
$limit = $objArticles->numRows;
$count = 0;
while ($objArticles->next()) {
// init FrontendTemplate if theres no object given
if (!$objTemplate) {
$objTemplate = new FrontendTemplate($this->news4ward_template);
}
$objTemplate->setData($objArticles->row());
$objTemplate->count = ++$count;
$objTemplate->class = (strlen($objArticles->cssClass) ? ' ' . $objArticles->cssClass : '') . ($count == 1 ? ' first' : '') . ($count == $limit ? ' last' : '') . ($count % 2 == 0 ? ' odd' : ' even') . ($objArticles->highlight ? ' highlight' : '');
$objTemplate->link = $this->News4wardHelper->generateUrl($objArticles);
$objTemplate->archive = $objArticles->archive;
// Clean the RTE output for the TEASER
if ($objArticles->teaser != '') {
if ($objPage->outputFormat == 'xhtml') {
$objArticles->teaser = $this->String->toXhtml($objArticles->teaser);
} else {
$objArticles->teaser = $this->String->toHtml5($objArticles->teaser);
}
$objTemplate->teaser = $this->String->encodeEmail($objArticles->teaser);
}
// Generate ContentElements
$objContentelements = $this->Database->prepare('SELECT id FROM tl_content WHERE pid=? AND do="news4ward" ' . (!BE_USER_LOGGED_IN ? " AND invisible=''" : "") . ' ORDER BY sorting ')->execute($objArticles->id);
$strContent = '';
while ($objContentelements->next()) {
$strContent .= $this->getContentElement($objContentelements->id);
}
// Clean the RTE output for the CONTENT
if ($strContent != '') {
// Clean the RTE output
if ($objPage->outputFormat == 'xhtml') {
$strContent = $this->String->toXhtml($strContent);
} else {
$strContent = $this->String->toHtml5($strContent);
}
$strContent = $this->String->encodeEmail($strContent);
}
$objTemplate->content = $strContent;
// Add meta information
$arrMeta = $this->getMetaFields($objArticles);
$objTemplate->date = $arrMeta['date'];
$objTemplate->hasMetaFields = count($arrMeta) ? true : false;
$objTemplate->timestamp = $objArticles->start;
$objTemplate->author = $arrMeta['author'];
$objTemplate->datetime = date('Y-m-d\\TH:i:sP', $objArticles->start);
// Add teaser image
if ($objArticles->teaserImage && is_file(TL_ROOT . '/' . $objArticles->teaserImage)) {
$imgSize = deserialize($this->imgSize, true);
$objTemplate->arrSize = $imgSize;
if (count($imgSize) > 1) {
$objTemplate->teaserImage = $this->getImage($objArticles->teaserImage, $imgSize[0], $imgSize[1], $imgSize[2]);
} else {
$objTemplate->teaserImage = $objArticles->teaserImage;
}
$objTemplate->teaserImageRaw = $objTemplate->teaserImag;
}
// HOOK: add custom logic
if (isset($GLOBALS['TL_HOOKS']['News4wardParseArticle']) && is_array($GLOBALS['TL_HOOKS']['News4wardParseArticle'])) {
foreach ($GLOBALS['TL_HOOKS']['News4wardParseArticle'] as $callback) {
$this->import($callback[0]);
$this->{$callback}[0]->{$callback}[1]($this, $objArticles, $objTemplate);
}
}
$arrArticles[] = $objTemplate->parse();
}
return $arrArticles;
}