ユーザ用ツール

サイト用ツール


サイドバー

Index

はじめてのおつかい






DokuWiki整形記法


PlayGround



web:modx:revolution:minitips

文書の過去の版を表示しています。


mini tips

MODx Revolutionの独立したページを作るほどではないけれど、メモっておきたいTipsなど。

chunkとプレースホルダ

$modx->setPlaceholder('プレースホルダ名', $value);
$output =  $modx->getChunk('chunk name');
[[~[[*id]]]]

includeファイルでのmodxオブジェクトの使用

この一文を入れておけば使用可能。

global $modx;

リダイレクト

ID 34のページにリダイレクトする場合。

$url = $modx->makeUrl(34);
$modx->sendRedirect($url);

HTTPレスポンスヘッダで、「301 Moved Permanently」(永久的な移転)を返す場合。

$modx->sendRedirect('http://example.com',array('responseCode' => 'HTTP/1.1 301 Moved Permanently'));

参考

ログイン中のユーザID、ユーザ名の表示

[[+modx.user.id]] - Prints the ID
[[+modx.user.username]] - Prints the username
web/modx/revolution/minitips.1492147293.txt.gz · 最終更新: 2017/04/14 14:21 by 127.0.0.1