web:modx:revolution:minitips
目次
mini tips
MODx Revolutionの独立したページを作るほどではないけれど、メモっておきたいTipsなど。
MODxのバージョン
SELECT VALUE FROM modx_system_settings WHERE modx_system_settings.key = 'settings_version';
$version = $modx->getOption('settings_version'); OR [[++settings_version]]
chunkとプレースホルダ
$modx->setPlaceholder('プレースホルダ名', $value); $output = $modx->getChunk('chunk name');
自分自身へのLink
[[~[[*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.txt · 最終更新: 2019/07/05 01:50 by hayashi