How to pass Joomla parameters to an iframe (wrapper) page?

后端 未结 2 1719
情歌与酒
情歌与酒 2021-01-27 06:14

I try to fetch my users information using the getUser() function with a php script located in a iframe (wrapper) of Joomla. It seems there is problem passing parameters to ifram

2条回答
  •  北荒
    北荒 (楼主)
    2021-01-27 07:00

    Of course, the page that includes the iframe doesn't "know" Joomla - it's a different environment!

    If I understood correctly what you're trying to achieve, then you really should create an article in Joomla that displays the user information, but instead of getting the user-id from:

    $user = JFactory::getUser();
    

    you should send it as POST/GET parameter from the OUTER page (you can add some kind of auth-string if security matters to you). The article will read this POST/GET parameter and display the user's information respectively.

    The OUTER page (the one that contains the iframe) should refresh the iframe and use, as a url, the same url that displays the article (make sure it has "public" permissions) but will also send the user-id as parameter, for example:

    iframe src="http://?id=articleId&userId=
    

    hope it helps!

提交回复
热议问题