How to pass Joomla 1.0 parameters to an iframe (wrapper) page - Joomla & VirtueMart Tips & How To's

GJC Website Design UK, Joomla Developer, VirtueMart Developer, Template Developer, web site designs, England, Britain, UK, Belgium, search-engine optimisation (SEO). Multilingual.

Home Joomla VirtueMart Tips How to pass Joomla 1.0 parameters to an iframe (wrapper) page

Mon

27

Apr

How to pass Joomla 1.0 parameters to an iframe (wrapper) page
  • Joomla 1.0
  • com_wrapper

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.

Joomla com_wrapper parameters 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
 
VirtueMart
Your Cart is currently empty.

Latest Joomla & VirtueMart Tips

See all tips & examples



How to pass Joomla 1.0 parameters to an iframe (wrapper) page|Joomla & VirtueMart Tips & How To's



GJC Website Design UK, Joomla Developer, VirtueMart Developer, Template Developer, web site designs, England, Britain, UK, Belgium, search-engine optimisation (SEO). Multilingual.


params, url, username, def, row, emailadd, wrapper, joomla, email, line, menu, parameters, page, variables, add, com, mainframe, src, iframe, file, components, user, auto, button, pass, root, change, php, using, showwrap, height, function, append, address, array, used, construction, like, session, pulled


guru

We use cookies to improve our website and your experience when using it. Cookies used for the essential operation of the site have already been set.
To find out more about the cookies we use and how to delete them, see our privacy policy.

I accept cookies from this site.