Hopefully this is an easy one! I’m trying to discover how I can control where the login template will appear when using a restricted page (a page that that requires a user to have permission to view it). My login template is working and appears on the page however it is in the first content area on the page instead of the one I need it to be in. Is it possible to control where the login template appears?
Developer forum
E-mail notifications
Position Login template
Alec Stubbs
Replies
Mikkel Ricky
Posted on 18/06/2014 16:04:22
You can use the DwLoginBox tag to render the login box in a specific location (see http://templates.dynamicweb-cms.com/TemplateTags/Dynamicweb-template-tags/Page-tags/Page/DwLoginBox.aspx). However, the login box is also rendered in the default content placeholder and therefore you have to hide this if a user is not logged in:
@if (GetGlobalValue("Global:Page.IsProtected") == "true" && Pageview.User.UserID == 0) {
@GetValue("DwLoginBox")
}
…
@if (GetGlobalValue("Global:Page.IsProtected") != "true" || Pageview.User.UserID > 0) {
<div class="dwcontent" id="content"></div>
}
Best regards,
Mikkel
Alec Stubbs
Posted on 18/06/2014 16:29:49
This post has been marked as an answer
Thanks Mikkel, I didn't know about DwLoginBox. After doing a bit of searching about it I've found another way is to set the settings of the dwcontent area that you want to show the login template in to default eg settings="default:true"
Votes for this answer: 1
Mikkel Ricky
Posted on 19/06/2014 10:13:18
Nice find. The default:true setting is a better way to do it.
You must be logged in to post in the forum