更新时间:2023-12-04 10:08:58
我会回答自己的问题,因为我肯定会有人将来需要这个,我的解决方案只涉及一些额外的代码规则,然后你可以设置每个文章等...到注册,你会看到一个登录字段,当用户没有登录。
Im gonna answer my own question, because Im sure people will need this in the future, and my solution only involves a few rules of extra code and then you can set every article etc... to Registered and you'll see a login field when a user is not logged in.
在你的模板中,index.php放在靠近顶部的地方,它会获得你的文章的访问级别。
In your templates index.php place this near the top, it gets your article's access level.
$article =& JTable::getInstance("content");
$article->load(JRequest::getVar('id'));
$cAccLevel = $article->get("access");
然后在组件上面添加一个模块位置,只有当你需要的访问级别> 1
Then add a module position above your component, and only show it when your needed access level is > 1
<?php if($cAccLevel > 1): ?>
<jdoc:include type="modules" name="LOGIN_MODULE_POSITION" />
<?php endif; ?>
然后在模块管理器中将登录模块添加到LOGIN_MODULE_POSITION。
Then add a login module in your module manager to LOGIN_MODULE_POSITION.
Voila ...没有路由需要等等...一切正常工作,我选择风格离开注销框和操作字段像这样:
Voila... no routing needed etc... everything works out of the box, I chose to style away the logout box and action field like this:
.logout-button,
.actions{
display:none;
}
祝你好运!