21290 Posts in 5733 Topics by 2602 members
General Questions
SilverStripe Forums » General Questions » Looking for a way to target the CMS Login page using <% if RecordClassName = ??? %>
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 336 Views |
-
Looking for a way to target the CMS Login page using <% if RecordClassName = ??? %>

15 May 2012 at 11:18am
Hi there,
I am looking for a way the target the login form to display a default heading (e.g)
<h1><% if RecordClassName = ??? %>Please login to the CompanyName website<% else %>$Heading<% end_if %></h1>I know I can create a Security_login.ss but in this case I need to be more specific. Any help would be greatly appreciated. Cheers!
- Rich
-
Re: Looking for a way to target the CMS Login page using <% if RecordClassName = ??? %>

20 May 2012 at 12:19pm
Well ClassName will match any security page (login, forgot password etc) so if thats not an issue you can use <% if ClassName = Security %> otherwise you'll need a function in your Page.php which sniffs for the title (you can't have spaces in your <% if %> for 2.*).
// mysite/code/page.php
function isLoginPage() {
return ($this->Title == "Login");
}<% if isLoginPage %>
-
Re: Looking for a way to target the CMS Login page using <% if RecordClassName = ??? %>

21 May 2012 at 3:44pm Last edited: 21 May 2012 3:54pm
Hi Will,
Thanks for the response for some reason your suggestion didn't work for me. However your code gave me an idea I could accomplish what I was wanting to do using:
<% if URLSegment=Security %>Thanks again
- Rich
-
Re: Looking for a way to target the CMS Login page using <% if RecordClassName = ??? %>

21 May 2012 at 3:58pm
You may also have the same issue with using that as using ClassName = Security, in that forgot password, login and all security/ pages may by oversight all use security has the url segment.
| 336 Views | ||
|
Page:
1
|
Go to Top |


