Foren

How to know if a page is private or public?

Fernando Cabrera, geändert vor 9 Jahren.

How to know if a page is private or public?

Junior Member Beiträge: 47 Beitrittsdatum: 01.08.14 Neueste Beiträge
Hello

As the tittle says... How to know if a page is private or public? I need to implement some logic in a velocity file from my custom theme only for private pages.

I found this page Access Objects from Velocity and it seems very useful but I need some help with the API because I don't know which utility class has a method for what I'm looking.

I thought in a workaround making my condition a theme property, but I don't want to depend from the admin user emoticon

Thank you
thumbnail
Jeffrey Paul Handa, geändert vor 9 Jahren.

RE: How to know if a page is private or public? (Antwort)

Liferay Master Beiträge: 541 Beitrittsdatum: 01.12.08 Neueste Beiträge
Hi Fernando,

You could do something like:


#if ($layout.isPrivateLayout())
  ## Do something interesting
#end
Fernando Cabrera, geändert vor 9 Jahren.

RE: How to know if a page is private or public?

Junior Member Beiträge: 47 Beitrittsdatum: 01.08.14 Neueste Beiträge
Thank you Jeffrey, I had faith that was something simple

Just to complement the question/answer, my code adds a link to public home page in the navigation bar of private pages:

#if ($layout.isPrivateLayout() && $show_home)
  <li>
    <a href="$home_url">
      <span> $home_text </span>
    </a>
  </li>
#end