title: Liferay: No Layout exists with the primary key 0
body: <p>I am having troubles with my Liferay-Portal after I included a function to generate the friendly URL. This is the function:</p>
  
  <pre><code>#set ($layoutLocalService = $serviceLocator.findService("com.liferay.portal.service.LayoutLocalService"))
  #set ($layoutId = $getterUtil.getLong($image-link.getData()))
  #set ($themeDisplay = $request.get('theme-display'))
  #set ($currentPlid = $getterUtil.getLong($themeDisplay.get('plid')))
  #set ($currentLayout = $layoutLocalService.getLayout($currentPlid))
  #set ($layout = $layoutLocalService.getLayout($getterUtil.getLong($groupId), $currentLayout.isPrivateLayout(), $layoutId))
  #set( $friendlyUrl = $layout.getFriendlyURL().replace("/", "") )
  </code></pre>
  
  <p>After a successful deployment, while surfing over the website my console outputs this:</p>
  
  <pre><code>09:15:26,279 ERROR [http-bio-8080-exec-83][LiferayMethodExceptionEventHandler:33] com.liferay.portal.NoSuchLayoutException: No Layout exists with the primary key 0
  com.liferay.portal.NoSuchLayoutException: No Layout exists with the primary key 0
  </code></pre>
  
  <p><strong>How do I get the layoutID of the current page and not of that image link?</strong></p>