Skip to content

Instantly share code, notes, and snippets.

@rotty3000
Created October 14, 2011 16:46
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rotty3000/1287646 to your computer and use it in GitHub Desktop.
create a PortletURL in PHP
<?php
/*
* You need the fix from:
* http://issues.liferay.com/browse/LPS-22161
* (git 8f7c48746f9282e6037112220f9232786747d896)
*/
import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.portal.util.PortletKeys;
import com.liferay.portlet.PortletURLFactoryUtil;
import javax.portlet.PortletMode;
import javax.portlet.PortletRequest;
import javax.portlet.WindowState;
$request = quercus_servlet_request();
$themeDisplay = $request->getAttribute(WebKeys::THEME_DISPLAY);
$myAccountURL = PortletURLFactoryUtil::create(
$request, PortletKeys::MY_ACCOUNT, $themeDisplay->getPlid(),
PortletRequest::RENDER_PHASE);
$myAccountURL->setWindowState(WindowState::MAXIMIZED);
$myAccountURL->setPortletMode(PortletMode::VIEW);
$myAccountURL->setParameter("struts_action", "/my_account/edit_user");
?>
<a href="<?php echo $myAccountURL->toString(); ?>">My Account</a>
<?php include("navigation.php"); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment