Mon 27 Apr |
|
If we are using an iframe (wrapper) within our content we sometimes need to pass Joomla parameters to the called page. If were still using Joomla 1.0 we have to change the core files. Open in your editor the file - joomla_root/components/com_wrapper/wrapper.php and go to line 24. Add the $my parameter to the showWrap function function showWrap( $option ) { global $database, $Itemid, $mainframe, $my;Then around line 37 set the 2 $username and $emailaddress variables - $menu = $mainframe->get( 'menu' ); $params = new mosParameters( $menu->params ); $params->def( 'back_button', $mainframe->getCfg( 'back_button' ) ); $params->def( 'scrolling', 'auto' ); $params->def( 'page_title', '1' ); $params->def( 'pageclass_sfx', '' ); $params->def( 'header', $menu->name ); $params->def( 'height', '500' ); $params->def( 'height_auto', '0' ); $params->def( 'width', '100%' ); $params->def( 'add', '1' ); $url = $params->def( 'url', '' ); $username = $my->username; $emailadd = $my->email;Then add them to the $row array around line 49 - } else { $row->url = $url; $row->username = $username; $row->emailadd = $emailadd; } } else { $row->url = $url; $row->username = $username; $row->emailadd = $emailadd; }We need to pass these new variables to the url construction in file - joomla_root/components/com_wrapper/wrapper.php at line 49. Change from src="<?php echo $row->url; ?>" to src="<?php echo $row->url."?username=". $row->username."&email=". $row->emailadd; ?>" 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 Tuesday, 05 May 2009 11:54 |