本文整理汇总了PHP中rex_article::setMode方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_article::setMode方法的具体用法?PHP rex_article::setMode怎么用?PHP rex_article::setMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_article
的用法示例。
在下文中一共展示了rex_article::setMode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: eval
echo rex_warning($message);
}
echo '
<div class="rex-cnt-bdy">
';
if ($mode == 'edit') {
// ------------------------------------------ START: MODULE EDITIEREN/ADDEN ETC.
echo '
<!-- *** OUTPUT OF ARTICLE-CONTENT-EDIT-MODE - START *** -->
<div class="rex-cnt-editmode">
';
$CONT = new rex_article();
$CONT->message = $message;
$CONT->setArticleId($article_id);
$CONT->setSliceId($slice_id);
$CONT->setMode($mode);
$CONT->setCLang($clang);
$CONT->setEval(TRUE);
$CONT->setFunction($function);
eval("?>" . $CONT->getArticle($ctype));
echo '
</div>
<!-- *** OUTPUT OF ARTICLE-CONTENT-EDIT-MODE - END *** -->
';
// ------------------------------------------ END: MODULE EDITIEREN/ADDEN ETC.
} elseif ($mode == 'meta') {
// ------------------------------------------ START: META VIEW
echo '
<div class="rex-cnt-metamode">
<form action="index.php" method="post" enctype="multipart/form-data" id="REX_FORM">
<fieldset>
示例2: rex_generateArticle
/**
* Generiert alle *.article u. *.content Dateien eines Artikels/einer Kategorie
*
* @param $id ArtikelId des Artikels, der generiert werden soll
* @param $refreshall Boolean Bei True wird der Inhalte auch komplett neu generiert, bei False nur die Metainfos
*/
function rex_generateArticle($id, $refreshall = true)
{
global $REX, $I18N;
// artikel generieren
// vorraussetzung: articel steht schon in der datenbank
//
// -> infos schreiben -> abhaengig von clang
// --> artikel infos / einzelartikel metadaten
// --> artikel content / einzelartikel content
// --> listen generieren // wenn startpage = 1
// ---> artikel liste
// ---> category liste
// --------------------------------------------------- generiere generated/articles/xx.article
foreach ($REX['CLANG'] as $clang => $clang_name) {
$MSG = '';
$CONT = new rex_article();
$CONT->setCLang($clang);
$CONT->getContentAsQuery();
$CONT->setMode("generate");
// keine Ausgabe als eval(CONTENT) sondern nur speichern in datei
if (!$CONT->setArticleId($id)) {
return false;
}
// --------------------------------------------------- Artikelparameter speichern
$params = array('article_id' => $id, 'last_update_stamp' => time());
$class_vars = OORedaxo::getClassVars();
unset($class_vars[array_search('id', $class_vars)]);
$db_fields = $class_vars;
foreach ($db_fields as $field) {
$params[$field] = $CONT->getValue($field);
}
$content = '<?php' . "\n";
foreach ($params as $name => $value) {
$content .= '$REX[\'ART\'][' . $id . '][\'' . $name . '\'][' . $clang . '] = \'' . rex_addslashes($value, '\\\'') . '\';' . "\n";
}
$content .= '?>';
if ($fp = @fopen($REX['INCLUDE_PATH'] . "/generated/articles/{$id}.{$clang}.article", "w")) {
fputs($fp, $content);
fclose($fp);
@chmod($REX['INCLUDE_PATH'] . "/generated/articles/{$id}.{$clang}.article", 0777);
} else {
$MSG = $I18N->msg('article_could_not_be_generated') . " " . $I18N->msg('check_rights_in_directory') . $REX['INCLUDE_PATH'] . "/generated/articles/";
}
// --------------------------------------------------- Artikelcontent speichern
if ($refreshall) {
if ($fp = @fopen($REX['INCLUDE_PATH'] . "/generated/articles/{$id}.{$clang}.content", "w")) {
$article_content = "?>" . $CONT->getArticle();
fputs($fp, $article_content);
fclose($fp);
@chmod($REX['INCLUDE_PATH'] . "/generated/articles/{$id}.{$clang}.content", 0777);
} else {
$MSG = $I18N->msg('article_could_not_be_generated') . " " . $I18N->msg('check_rights_in_directory') . $REX['INCLUDE_PATH'] . "/generated/articles/";
}
}
// ----- EXTENSION POINT
$MSG = rex_register_extension_point('CLANG_ARTICLE_GENERATED', '', array('id' => $id, 'clang' => $clang, 'article' => $CONT));
if ($MSG != '') {
echo rex_warning($MSG);
}
// --------------------------------------------------- Listen generieren
if ($CONT->getValue("startpage") == 1) {
rex_generateLists($id);
rex_generateLists($CONT->getValue("re_id"));
} else {
rex_generateLists($CONT->getValue("re_id"));
}
}
// ----- EXTENSION POINT
$MSG = rex_register_extension_point('ARTICLE_GENERATED', '', array('id' => $id));
}