Passing a URL to the wrapper

Need help with the Administration of your Joomla! 1.5 site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
User avatar
classixuk
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 108
Joined: Tue Nov 07, 2006 5:14 pm

Passing a URL to the wrapper

Post by classixuk » Thu Sep 25, 2008 5:58 pm

Hi folks,

I need to be able to pass an external URL to the wrapper for a project I am doing.

Currently, in 1.5, I see that the wrapper URL looks like this:

Code: Select all

http://www.yourdomain.com/joomla/index.php?option=com_wrapper&view=wrapper&Itemid=1000
What I need to be able to do is simply add a URL onto the end of the above, instaed of Item ID, e.g.

Code: Select all

http://www.yourdomain.com/joomla/index.php?option=com_wrapper&view=wrapper&url=www.google.co.uk
I tried this, but a pop-up box said "The URL is not valid and cannot be loaded".

What am I doing wrong here? Is there no way I can just add the URL (which keeps changing dynamically, otherwise I would just use the regular Wrapper menu builder)?


This is quite important.

Thanks.

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11507
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: Passing a URL to the wrapper

Post by ooffick » Fri Sep 26, 2008 3:12 pm

Hi,

you can do that with a template overwrite:
  1. create a folder in your template folder called "html" (if it doesn't exists)
  2. create a folder in that html folder called "com_wrapper" (if it doesn't exists)
  3. create a folder in that com_wrapper folder called "wrapper" (if it doesn't exists)
  4. copy the file .../components/com_wrapper/views/wrapper/tmpl/default.php in this .../templates/[your-template]/html/com_wrapper/wrapper/ folder
  5. open that file
  6. locate the following line (line 24):

    Code: Select all

    	src="<?php echo $this->wrapper->url; ?>"
  7. and replace it with the following:

    Code: Select all

    	src="<?php echo "http://".JRequest::getVar('url'); ?>"
Let me know if that doesn't work,
Olaf
Last edited by ooffick on Sat Jul 18, 2009 10:26 am, edited 1 time in total.
Reason: changed typo
Olaf Offick - Global Moderator
learnskills.org

User avatar
classixuk
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 108
Joined: Tue Nov 07, 2006 5:14 pm

Re: Passing a URL to the wrapper

Post by classixuk » Fri Sep 26, 2008 3:30 pm

Thanks oofick,

I will give that a try and let you know how I get on!

Many thanks.

:)

User avatar
humvee
Joomla! Master
Joomla! Master
Posts: 14713
Joined: Wed Aug 17, 2005 10:27 pm
Location: Kent, England

Re: Passing a URL to the wrapper

Post by humvee » Fri Oct 03, 2008 8:02 am

[Mod Note: Bump post by classixuk deleted. Please do not bump your messages. Read the Forum Rules for full details.

User avatar
classixuk
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 108
Joined: Tue Nov 07, 2006 5:14 pm

Re: Passing a URL to the wrapper

Post by classixuk » Sat Oct 25, 2008 5:46 pm

Hi oofick.

I hope you are still around.

I tried the above with some success. Thankyou.

However, I cannot use my normal wrapper links in Joomla (the ones with menu id's).

Is there a way around is, or do I have to set my normal wrapper menu links to "external links"?

Many thanks.

P.S. Basically what I am trying to do, is make all external links from my site open in the wrapper. :)

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11507
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: Passing a URL to the wrapper

Post by ooffick » Tue Oct 28, 2008 9:47 am

Hi, you could try something like this:

Code: Select all

src="<?php if(emtpy(JRequest::getVar('url'))) {echo $this->wrapper->url; } else {echo "http://".JRequest::getVar('url');} ?>"
Olaf
Olaf Offick - Global Moderator
learnskills.org

deepandtwisted
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Mon Aug 28, 2006 6:23 pm

Re: Passing a URL to the wrapper

Post by deepandtwisted » Thu Nov 13, 2008 10:02 am

Brilliant this is exactly what I've been looking for however I can't seem to get your second example to work

Code: Select all

src="<?php if(emtpy(JRequest::getVar('url'))) {echo $this->wrapper->url; } else {echo "http://".JRequest::getVar('url');} ?>"
it goes to a blank page with just the iframe and if i view the page source there is the following error

Code: Select all

<b>Fatal error</b>:  Call to undefined function emtpy() in <b>/homepages/46/d239862995/htdocs/the-plug.com/v2/templates/yoo_chrome/html/com_wrapper/wrapper/default.php</b> on line <b>24</b><br />

moooh
Joomla! Explorer
Joomla! Explorer
Posts: 382
Joined: Sat Aug 30, 2008 11:09 am

Re: Passing a URL to the wrapper

Post by moooh » Thu Nov 13, 2008 11:09 am

It's simply a misspell of the function "empty" in his example code.

Replace the emtpy with empty and you should be all fine.

Code: Select all

src="<?php if(empty(JRequest::getVar('url'))) {echo $this->wrapper->url; } else {echo "http://".JRequest::getVar('url');} ?>"

deepandtwisted
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Mon Aug 28, 2006 6:23 pm

Re: Passing a URL to the wrapper

Post by deepandtwisted » Thu Nov 13, 2008 12:47 pm

Good spot, however a new error message is now returned.

Code: Select all

Fatal error: Can't use function return value in write context in

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11507
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: Passing a URL to the wrapper

Post by ooffick » Thu Nov 13, 2008 1:02 pm

In which line/file do you have that? Can you post the full Error message?

Olaf
Olaf Offick - Global Moderator
learnskills.org

deepandtwisted
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Mon Aug 28, 2006 6:23 pm

Re: Passing a URL to the wrapper

Post by deepandtwisted » Thu Nov 13, 2008 1:23 pm

Code: Select all

Fatal error: Can't use function return value in write context in /templates/yoo_chrome/html/com_wrapper/wrapper/default.php on line 24
which relates to

Code: Select all

src="<?php if(empty(JRequest::getVar('url'))) {echo $this->wrapper->url; } else {echo "http://".JRequest::getVar('url');} ?>"

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11507
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: Passing a URL to the wrapper

Post by ooffick » Thu Nov 13, 2008 1:59 pm

Which Joomla version do you have?

Can you try this one:

Code: Select all

src="<?php if(JRequest::getVar('url',"") == "") {echo $this->wrapper->url; } else {echo "http://".JRequest::getVar('url');} ?>"
Olaf
Olaf Offick - Global Moderator
learnskills.org

deepandtwisted
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Mon Aug 28, 2006 6:23 pm

Re: Passing a URL to the wrapper

Post by deepandtwisted » Thu Nov 13, 2008 2:51 pm

ooffick wrote:Which Joomla version do you have?

Can you try this one:

Code: Select all

src="<?php if(JRequest::getVar('url',"") == "") {echo $this->wrapper->url; } else {echo "http://".JRequest::getVar('url');} ?>"
Olaf
Yes that works. Thankyou.

alivebyscience
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Thu May 03, 2007 9:01 pm

Re: Passing a URL to the wrapper

Post by alivebyscience » Sun Nov 16, 2008 4:25 am

Would someone care to explain to me the assumptions of this thread?

For example... Why do you want to pass a URL to a wrapper when a wrapper by definition is a URL? In other words what is the shortcoming of the existing mechanism, and what did the above accomplish?

Obviously I'm missing something and I'd like to understand.

Thanks in advance.

deepandtwisted
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Mon Aug 28, 2006 6:23 pm

Re: Passing a URL to the wrapper

Post by deepandtwisted » Mon Nov 17, 2008 9:03 am

alivebyscience wrote:Would someone care to explain to me the assumptions of this thread?

For example... Why do you want to pass a URL to a wrapper when a wrapper by definition is a URL? In other words what is the shortcoming of the existing mechanism, and what did the above accomplish?

Obviously I'm missing something and I'd like to understand.

Thanks in advance.
For example I have events listings on my site and for each event I have a buy button that needs to link to my shop. My shop is not a Joomla component and therefore needs to sit inside a wrapper. With the normal setup I would need to create a wrapper menu item for every link I require, this method means I don't. Hope that clears it up.

alivebyscience
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Thu May 03, 2007 9:01 pm

Re: Passing a URL to the wrapper

Post by alivebyscience » Mon Nov 17, 2008 6:02 pm

So the code change indicated above then does what... grabs the link of your buy button which is the shopping cart link and appends it to the wrapper link? Which in turn opens the shopping cart in the iFrame?

Thanks for trying to clue me in to the assumptions. I'm still working on connecting the dots.

User avatar
borisgoodenough
Joomla! Apprentice
Joomla! Apprentice
Posts: 23
Joined: Sun Dec 03, 2006 3:57 pm

Re: Passing a URL to the wrapper

Post by borisgoodenough » Wed Dec 10, 2008 8:23 pm

Ooffick or others,

This override is just what I was looking for, and it's working perfectly. But I can't make the style choices -- wrapper width, height, title -- which would typically get set in the menu item for a normal wrapper.

Any idea how to make that work?

Thanks!

Joel

enmadmin
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Sun Oct 05, 2008 9:10 am

Re: Passing a URL to the wrapper

Post by enmadmin » Fri Dec 12, 2008 8:56 pm

ooffick wrote:Which Joomla version do you have?

Can you try this one:

Code: Select all

src="<?php if(JRequest::getVar('url',"") == "") {echo $this->wrapper->url; } else {echo "http://".JRequest::getVar('url');} ?>"
Olaf

Dear ooffick,
thank you! this works perfectly.
A beginner's question: can the security be affected if hackers tamper with the url parameter?
thanks!

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11507
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: Passing a URL to the wrapper

Post by ooffick » Sat Dec 13, 2008 10:52 am

By using this, a possible hacker could make any website apear in that frame, by just sending you a modified link, but this would only affect that page.

Olaf
Olaf Offick - Global Moderator
learnskills.org

BaidareW
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Tue Jan 13, 2009 7:13 pm

Re: Passing a URL to the wrapper

Post by BaidareW » Sat Jan 31, 2009 8:51 pm

Hi wise people :)

I tryed to do steps writed here but I get error in wrapper (translated: inside acces error.. you are trying to reach adress that is unavailable now..).

I used such

Code: Select all

link: http://localhost/joomla15/index.php?option=com_wrapper&view=wrapper&url=google.com (so it should open google.com)
. Maybe it is not correct format for passing url ?

Any help ? Thanks in advance.

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11507
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: Passing a URL to the wrapper

Post by ooffick » Sun Feb 01, 2009 8:34 pm

Did you follow the steps below as posted above:
ooffick wrote:
  1. create a folder in your template folder called "html" (if it doesn't exists)
  2. create a folder in that html folder called "com_wrapper" (if it doesn't exists)
  3. create a folder in that com_wrapper folder called "frontpage" (if it doesn't exists)
  4. copy the file .../components/com_wrapper/views/wrapper/tmpl/default.php in this .../templates/[your-template]/html/com_wrapper/wrapper/ folder
  5. open that file
  6. locate the following line (line 24):

    Code: Select all

    	src="<?php echo $this->wrapper->url; ?>"
  7. and replace it with the following:

    Code: Select all

    	src="<?php echo "http://".JRequest::getVar('url'); ?>"
Olaf
Olaf Offick - Global Moderator
learnskills.org

BaidareW
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Tue Jan 13, 2009 7:13 pm

Re: Passing a URL to the wrapper

Post by BaidareW » Sun Feb 01, 2009 9:32 pm

Thank you Olaf.

I used your ather suggestion:

Code: Select all

src="<?php if(JRequest::getVar('url',"") == "") {echo $this->wrapper->url; } else {echo "http://".JRequest::getVar('url');} ?>"
All steps did exactly exept this one with replacement as I read that first code didn't work. I will try to replace with first one if you think it should work for me.

Is my link in right format ?

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11507
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: Passing a URL to the wrapper

Post by ooffick » Mon Feb 02, 2009 9:05 am

When you access the link what happends instead?
Is there a error message?


Olaf
Olaf Offick - Global Moderator
learnskills.org

BaidareW
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Tue Jan 13, 2009 7:13 pm

Re: Passing a URL to the wrapper

Post by BaidareW » Mon Feb 02, 2009 12:08 pm

I get error in wrapper, here is the translation (with google):

Internal communication error

You tried to reach the "http:/" address, which is currently unavailable. Check that the address (URL) correctly marked, and arranged or punctuation correct, then try to update the website again.
Please make sure that you connected the Internet and or other programs that use the same connection to the Internet, works.

Tryed you firs suggested string and it gaves me the same error.

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11507
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: Passing a URL to the wrapper

Post by ooffick » Mon Feb 02, 2009 12:32 pm

Are you sure you have http:// (with two slashes written)?

Olaf
Olaf Offick - Global Moderator
learnskills.org

BaidareW
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Tue Jan 13, 2009 7:13 pm

Re: Passing a URL to the wrapper

Post by BaidareW » Mon Feb 02, 2009 2:42 pm

I tryed without http:// with http:// and with http://www. but in error message I get "you tried to reach "http:/"..

So it seems that address is parsed not all, but only first 6 simbols as error do not dislpay address wich I am trying to reach. Realy stuck with it :(

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11507
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: Passing a URL to the wrapper

Post by ooffick » Mon Feb 02, 2009 3:20 pm

so your code looks like this in line 24:

Code: Select all

src="<?php echo "http://".JRequest::getVar('url'); ?>"
and you call your script like this, right:
http://www.your-domain.com/index.php?op ... google.com

right?

Which Joomla version do you have?

Olaf
Olaf Offick - Global Moderator
learnskills.org

BaidareW
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Tue Jan 13, 2009 7:13 pm

Re: Passing a URL to the wrapper

Post by BaidareW » Mon Feb 02, 2009 5:57 pm

I am using 1.5.9

The code is exactly as you wrote.

Maybe I could give you an ftp account to make such thing ? Because I really don't know where I am doing wrong thing..

I need to copy only this one file to created folder or all of them ? And what to do with

Code: Select all

create a folder in that com_wrapper folder called "frontpage" (if it doesn't exists)
as it is empty after everything.

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11507
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: Passing a URL to the wrapper

Post by ooffick » Mon Feb 02, 2009 6:06 pm

sorry, you will need to create the folder "wrapper" in there instead.

Olaf
Olaf Offick - Global Moderator
learnskills.org

BaidareW
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Tue Jan 13, 2009 7:13 pm

Re: Passing a URL to the wrapper

Post by BaidareW » Mon Feb 02, 2009 6:46 pm

Uff.. :) So now we know that there was error in your step 3.

And now default wrapper opens even overriding top of new page with title, how can I change the size of the wrapper ? Is there a file where default size for wrapper is written or ather way to change how it opens page.

And thank you Olaf for your time. Realy :)


Locked

Return to “Administration 1.5”