まず、$loggedin 変数を 2 番目のスニペットに渡しません。これは通常、投稿またはセッション変数で行います。
次に、もっと簡単に確認する方法があります。これらは Bob のガイドから直接引用したものです。
There are various methods. One easy method is to use this code:
if ($modx->user->get('username') == '(anonymous)') {
/* user is not logged in */
}
Here is the official method for seeing if the user is logged in
to the current context:
if ($modx->user->hasSessionContext($modx->context->get('key'))) {
/* user is logged in */
}
If you know the name of the current context (e.g., web),
you can use this method. The name of the context is required:
if $modx->user->isAuthenticated('web') {
/* user is logged in to web context */
}
つまり、何らかの理由で独自の認証をロールする必要がある場合です。~ それ以外の場合は、ログイン/登録エクストラがこれらすべてを行います。
*UPDATE***
同じリソース内の 1 つのスニペットから別のスニペットに 2 つのパス変数を渡すと、プレースホルダーを設定/取得できます。
<?php
// snippet one
$modx->setPlaceholder('output','Place holder set!');
<?php
// snippet two
$myvar = $modx->getPlaceholder('output');
echo 'this is the value of "output": '.$myvar;