Thu 23 Apr |
|
If we are using an iframe (wrapper) within our content we sometimes need to pass Joomla parameters to the called page. By using Joomla's template override system we don't have to touch any core files.
First of all create the needed folder structure in your own template folder.So in this case it would be joomla_root/templates/your_template/html/com_wrapper/wrapper . Then copy into the the new wrapper folder the file joomla_root/components/com_wrapper/views/wrapper/tmpl/default.php Now we need to make a few changes to this file that we have copied. Directly under line 2 (file access check) add this - $user =& JFactory::getUser();Then at line 24 change the code to read - src="<?php echo $this->wrapper->url."?username=".$user->username."&email=".$user->email; ?>"In this case it will append the username and email address of the logged in user to the iframe url like so - <iframe id="blockrandom" class="wrapper" height="500" frameborder="0" width="100%" scrolling="auto" align="top" src="http://www.gjcwebdesign.com/joomla-15-virtuemart-11-joomfish-20.html?username=Bert.&email= This e-mail address is being protected from spambots. You need JavaScript enabled to view it " name="iframe">You can send the other parameters such as real name, user id etc as well as session parameters. The parameters can be pulled by normal $_GET["email"] or $_REQUEST["email"] variables in the target page and used as you want. |
| Last Updated on Monday, 19 October 2009 15:25 |

First of all create the needed folder structure in your own template folder.






























I had a similar need and had the luxury of controlling code of both Joomla and iFrame webpage code. They were on the same server. I had old perl code that needed a username so all authentication occurred in Joomla. I found a module for perl that would read a PHP session. So I added the username to the session. This made it all server side and there is no way to inject a username to access the webpage.
So, if you can, sessions can be a good way to send info to an iFrame, but you need the pages to be on the same server.
Changed it in both articles to the correct syntax..
(mistake in yours as well..
Very good tutorial!
I searched for something like this since a long time!
But be carefull about the concatenation which is badly implemented.
When you have to modify the src field, it must be:
src="/wrapper->url."?username=".$user->username."&email=".$user->email; ?>"
Note that there's the same problem with the tutorial for joomla 1.0
That's a detail, but I wanted to tell you about it, and that's done!
Thank you again!
url1 = window.location.href;
lenurl1 = url1.length;
suburl1 = url1.substring(lenurl1-20,lenurl1);
url2 = document.getElementById("blockrandom").src;
lenurl2 = url2.length;
suburl2 = url2.substring(0,lenurl2-9);
url3 = suburl2 + suburl1;
document.getElementById("blockrandom").src = url3;
"blockrandom" is the id of the iframe's html code. the src object is the url that was passed by the wrapper's menu item. It's changed based on the content of the "current" URL.
Thye module itself is published, but writes nothing to the page.
The only think i've changed was the directory of default.php
I put it in /components/com_wrapper/
Thank you