0

In my application,the first page is Index.tml and I have a login form. The layout for this application has a menu with some links in it and I added another one which is called "Delogheza-te"=Log-out. What I want is that ,the "log-out link" to be visible only after the user logged-in. The log-out link should be visible on all pages except "Index.tml". How can I do that? I tryed this but it's wrong.

<t:if  t:page!="Index">
 <a href="#" t:type="PageLink" t:page="Index">Delogheaza-te</a>
 </t:if>
Alina Ali
  • 39
  • 1
  • 8

1 Answers1

1

For this situation I like to give the layout component a component parameter, maybe a boolean showLogout, which is true by default but can be set to false in some pages such as the index page.

-- in Layout.java --

@Parameter(value="true")
@Property
boolean showLogout;

-- in Layout.tml --

<t:if test="showLogout">
     (logout link here)
</t:if>

-- in Index.tml --

<html t:type="layout" showLogout="false">
Bob Harner
  • 757
  • 4
  • 6
  • Your code has meaning, and I understand it but it gives me an error for the line @Parameter(value=true). There is another way to write that line? – Alina Ali May 26 '18 at 19:26
  • I forgot the quotes. I think @Parameter(value="true") or @Parameter("true") will work, give that a try , – Bob Harner May 26 '18 at 23:58