web design, England, Britain, UK, belgium
 
Ulti Clocks content

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

GJC Web Design UK Joomla & VirtueMart how to, tips, tricks, coding examples, html, php, tutorial, 101, useful hints, help

A collection of help articles and coding examples for Joomla & Virtuemart

Belgium, VirtueMart & Joomla Web Design England UK Britain & Germany

Joomla, VirtueMart, how to, tips, tricks, coding examples, html, php, tutorial, 101, useful hints, help sand How to pass Joomla parameters to an iframe (wrapper) page by using the Joomla 1.5 Templates Override system.
wrapper, email, user, joomla, parameters, file, username, folder, template, case, line, using, iframe, url, page, root, getuser, append, jfactory, change, code, read, src, like, request, normal, variables, target, used, pulled, session, add, logged, send, real, address, php, core, touch, files

Home Joomla - VirtueMart Joomla & VM How To's How to pass Joomla 1.5 parameters to an iframe (wrapper) page

Thu

23

Apr

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

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.

Joomla template overrides 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.


Add this page to your favorite Social Bookmarking websites
Digg! Reddit! Del.icio.us! Mixx! Free and Open Source Software News Google! Live! Facebook! Slashdot! Technorati! StumbleUpon! Spurl! Newsvine! Furl! Fark! Yahoo! Netvouz! Mister-Wong! RawSugar! Ma.gnolia! Squidoo! DZone! Swik!
Last Updated on Monday, 19 October 2009 15:25
 

Add your comment

BoldItalicUnderlineStrikethroughSubscriptSuperscriptEmailImageHyperlinkOrdered listUnordered listQuoteCodeHyperlink to the Article by its id
Very HappySmileWinkSadSurprisedShockedConfusedCoolLaughingMadRazzEmbarrassedCrying or Very SadEvil or Very MadTwisted EvilRolling EyesExclamationQuestionIdeaArrowNeutralMr. GreenGeekUber Geek
Your name:
  The word for verification.
Lowercase letters only with no spaces.

The word for verification.<br/>Lowercase letters only with no spaces.
Word verification:

Subject:
Comment:
Comments (12)
Don´t work IE
12 Wednesday, 17 March 2010 23:01
Robinson
Don´t works in IE
coolest thing ever
11 Thursday, 17 December 2009 05:20
Jim Nayzium
wow -- this is the best add on ever ----
Passing Stuff in the URL
10 Tuesday, 24 November 2009 20:57
Demolishun
There is a problem with passing stuff in the URL if it is a password or username. This is insecure and could be used for someone to grab a username and password or try many usernames and passwords.

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.
pass login
9 Saturday, 14 November 2009 06:23
anom
using joomla 1.5.10 with mosiframe for 1.5... i need to pass the login username and password to the wrapped iframe login and have it pre-populate those fields. i've tried every variation of this that i could find, nothing is showing up in the url and $_GET doesn't work. Any suggestions?
Re: iFrame URL works, but the $_GET fails
8 Friday, 28 August 2009 16:55
Derek
I was able to implement this solution using the most recent version of Joomla! (1.5.14). Made a few mistakes at first, as a newbie to Joomla. Thought at first, as Ron suggested, that there was a problem passing the user parameter values in the URL, because if you hover over the link to the wrapper and look at the bottom of your browser window, you won't see them appended. (You can seem them briefly flashed, though, when you click the link.) Another problem I had, which probably seems obvious to those with more experience, is that when I tried to grab the passed parameter values in the wrapped page using $_GET(parameter), it didn't work at first because the wrapped page had a .html extension. When I changed the page extension to .php, everything worked fine. Hope that's of some help to others trying to use this trick.
@Zio
7 Monday, 03 August 2009 18:16
GJC (admin)
Can only agree, it was a mess!!!!
Changed it in both articles to the correct syntax..
(mistake in yours as well.. Wink
Some mistakes, but it works!
6 Monday, 03 August 2009 16:23
Zio
First of all, I apologize for my possible bad english, I'm french.

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! Mr. Green

Thank you again!
Another way
5 Friday, 31 July 2009 04:44
cocodeebo
I wanted to dynamically change the URL inside the wrapper. I wrote a Javascript module (type j15_html) that does something like this:

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.
Re: iFrame URL works, but the $_GET fails
4 Friday, 26 June 2009 01:05
Ron
On further testing, the src attribute in the iframe tag in Joomla 1.5.11 ALWAYS get changed to the URL in the Admin url parameter for the wrapper. It appears that you can not change that URL in the template copy of the default.php for the wrapper as previously done. Something has changed in this version.
iFrame URL works, but the $_GET fails
3 Thursday, 25 June 2009 11:50
Ron
I get the proper URL in the iFrame so this works in that regard. I'm using Joomla 1.5.11. However the actual $_GET does not extract the username or email out of that URL and in the iFrame. Any suggestions?
How to create Joomla Frame
2 Thursday, 18 June 2009 05:22
Deiva
How to create Joomla Frame
It works!!
1 Wednesday, 10 June 2009 02:53
Julian
It works perfect!! thanks a lot
The only think i've changed was the directory of default.php
I put it in /components/com_wrapper/

Thank you Smile

Our Recommended Reading

For those interested in extending their knowledge of Joomla! & VirtueMart, Packt Publishing has an excellent range of help & how to books.
Listed below are some I can recommend.
Simply click on the images to be taken directly to their web shop.


Joomla! Social Networking with JomSocial
Joomla! Social Networking
with JomSocial

by Kwasi Boateng & Beatrice A. Boateng.
Joomla! 1.5 Multimedia
Joomla! 1.5 Multimedia
by Allan Walker.


Building job sites with Joomla!
Building job sites with Joomla!
by Santonu Kumar Dhar.

Joomla! Template Design: Create your own professional-quality templates with this fast, friendly guide
Joomla! Template Design: 2nd Edition
Create your own professional-quality
templates with this fast, friendly guide
by Tessa Blakeley Silver.
Magento: Beginner's Guide
Magento: Beginner's Guide by William Rice
is a must for anyone trying the
open-source e-Commerce solution.

Read the review

object-oriented-javascript-applications-libraries
Object-Oriented JavaScript by
Stoyan Stefanov gives you a very
comprehensive grounding in
the latest Javascript techniques.

Read the review
Joomla! Web Security
Joomla! Web Security
by Tom Canavan.

Joomla 1.5 Top Extensions Cookbook
Joomla 1.5 Top Extensions Cookbook by
Suhreed Sarkar is an ideal and concise round up of the extensions available for the Joomla! system.

Read the review

Latest Articles

Paypal Donation

If you use this module on your site please donate a small amount.
Any donation amount appreciated.

VM Live Product Search

Recommended Reading

For those interested in extending there knowledge of Joomla! & VirtueMart Packt Publishing has an excellent range of help & how to books.
Listed below are some I can recommend.
Simply click on the images to be taken directly to their web shop.

Mastering Joomla! 1.5 Extension and Framework Development
Mastering Joomla! 1.5 Extension and
Framework Development : 2nd Edition

by James Kennard.
Read the review

Building job sites with Joomla!
Building job sites with Joomla!
by Santonu Kumar Dhar.
Learning Joomla! 1.5 Extension Development Learning Joomla! 1.5 Extension Development
by Joseph L. LeBlanc.
Read the review
Joomla! E-Commerce with VirtueMart
Joomla! E-Commerce with VirtueMart
by Suhreed Sarkar.

Read the review
Joomla! 1.5 Site Blueprints Joomla! 1.5 Site Blueprints
by Timi Ogunjobi.

Joomla! 1.5 JavaScript jQuery Joomla! 1.5 JavaScript jQuery
by Jose Argudo Blanco.
Read the review
Joomla! Social Networking with JomSocial Joomla! Social Networking with JomSocial
by Kwasi Boateng & Beatrice A. Boateng.

Joomla! 1.5 Multimedia Joomla! 1.5 Multimedia
by Allan Walker.

Joomla! Web Security Joomla! Web Security
by Tom Canavan.

Mastering Joomla! 1.5 Extension and Framework Development Mastering Joomla! 1.5 Extension and Framework Development : 2nd Edition
by James Kennard.

Joomla! Template Design: Create your own professional-quality templates with this fast, friendly guide Joomla! Template Design: Edition 2 - Create your own professional-quality templates with this fast, friendly guide
by Tessa Blakeley Silver.

Magento: Beginner's Guide
Magento: Beginner's Guide by William Rice
is a must for anyone trying the
open-source e-Commerce solution.

Read the review

GJC Web Design UK Joomla & VirtueMart how to, tips, tricks, coding examples, html, php, tutorial, 101, useful hints, help

A collection of help articles and coding examples for Joomla & Virtuemart

Belgium, VirtueMart & Joomla Web Design England UK Britain & Germany

Joomla, VirtueMart, how to, tips, tricks, coding examples, html, php, tutorial, 101, useful hints, help



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



How to pass Joomla parameters to an iframe (wrapper) page by using the Joomla 1.5 Templates Override system.


wrapper, email, user, joomla, parameters, file, username, folder, template, case, line, using, iframe, url, page, root, getuser, append, jfactory, change, code, read, src, like, request, normal, variables, target, used, pulled, session, add, logged, send, real, address, php, core, touch, files