Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions

<% IF $URL doesn't include 'Security' ....


Reply

6 Posts   897 Views

Avatar
Futureweb

1 August 2011 at 10:17pm Community Member, 233 Posts

Hi,

I've added a log in form etc to the header of my site (munromap.co.uk) by adding $LoginForm. All good.

However, if the user ends on original SS login page (links, incorrect password etc) then there are TWO login forms on the page - and the CSS is getting all messed up

I would like, on the /Security/ pages, to not show the log in page in the header - not just hide it via css, but actually not show it, so there aren't duplicated bits of forms around...

Any suggestions?

Avatar
swaiba

1 August 2011 at 11:21pm Forum Moderator, 1796 Posts

Probably best to do the logic of the if within php, rather than with the tempate...

template.ss

<% if SecurityLoginPage %>
<% else %>
//show form
<% end_if %>

Page.php

function SecurityLoginPage() {
return (strpos($_GET['url'],'Security')!==false); //note untested!
}

Avatar
Willr

3 August 2011 at 7:18pm Forum Moderator, 5511 Posts

Or you can use ClassName (saves adding that method)

<% if ClassName = Security %>
<% else %>
...
<% end_if %>

Avatar
Futureweb

3 August 2011 at 7:51pm (Last edited: 3 August 2011 7:56pm), Community Member, 233 Posts

Hi Willr - just tried that - sounds easier, but it made no change...

page just putting $ClassName on the page, i saw that the 'Security' pages are simply classname 'Page'...

so ended up using the function above - work fine...

Avatar
zenmonkey

4 August 2011 at 5:55am Community Member, 528 Posts

Security Pages have an ID of 0 so you could filter for if ID=0

Avatar
martimiz

4 August 2011 at 8:27am Forum Moderator, 1091 Posts

I think you can filter on <% if URLSegment != Security %> ... <% end_if %>