liferayliferay-6liferay-velocityliferay-theme

rendering Liferay page URLs inside of portlets Liferay 6.1


I'm new to liferay and I'm almost positive this is blazingly simple to do: Using velocity markup, I want to be able to generate links to pages within my Liferay website and embed them inside of my portlets on different pages.

I have a vague idea of how it might be done so I searched around figuring it would be posted somewhere, but I can't find anything on it. Incidentally, I want to put whatever code I come up with inside the view.jsp of the portlet. I would use velocity markup here but I don't think (don't know for sure) if that is allowed inside of a jsp.

Please let me know if you need more information to respond.


Solution

  • I would use velocity markup here but I don't think (don't know for sure) if that is allowed inside of a jsp.

    Why would you want to use Velocity mark-up inside a JSP (view.jsp)? I don't see any advantages in doing that apart from the argument that you are really great at velocity.

    Though here is a link that would help you embed velocity inside of JSP.

    Note: In my opinion it is not a good practice to embed velocity within JSP in a portlet

    In JSP:

    In VM (these would be *.vm files in themes):
    You can follow all the same steps as mentioned in JSP. The things you would need to do that are:

    You can check-out the following files for more details (if you are interested):

    1. docroot/html/themes/_unstyled/templates/init.vm, this contains all the velocity variables available in themes. Variables of interest might be $theme, $theme_display, $layout, $navItems.
    2. docroot/html/themes/_unstyled/templates/portlet.vm, this file is a template to display the individual portlets.
    3. docroot/html/themes/_unstyled/templates/navigation.vm, contains code for displaying the navigation menu with page links.
    4. docroot/html/themes/_unstyled/templates/portal_normal.vm, this file represents a page-template in liferay and this contains the other files like navigation.vm & portlet.vm.