Click to See Complete Forum and Search --> : iFrame and PHP problem....


jesseainskeep
09-27-2007, 01:54 PM
I'm having my first experience with iFrames and need some help.

I'm using the Joomla CMS and I created an application outside of Joomla that I want to display within Joomla (If that makes any sense).

The iFrame does work to show the project in Joomla, but I only want users to be able to look at the project through Joomla. To say it another way, I only want users to be able to look at this project through an iFrame. If they try to go straight to the URL, it would display an error message that this is not available.

I put this code at the top of the index file of the project which kind of worked:


if ($_SERVER['HTTP_REFERER'] != 'http://mysite.com/index.php?option=com_wrapper&Itemid=105'){
echo 'You are not authorized to view this directory';
exit();
}


If I view the directory directly (http://www.mysite.com/project) then I get the message. If I view the project through the link on the site, using iFrame, I can see the first page. The problem comes in when I click on a link in the iFrame. It pops this up in a new page, and since it comes from the iFrame instead of the Template, it puts the HTTP_REFERRER as something else, not letting me view the file.

Any ideas?

MrCoder
09-28-2007, 06:46 AM
An iFrame is just like having another window open within the page.

You could capture mouse clicks within the iFrame and then get the parent window to redirect the iFrame src based on the link that was clicked within the iFrame.

It is a lot of hassle to be honest, drop the iFrame and implement the project in to Joomla directly.

jesseainskeep
09-28-2007, 07:12 AM
I wish the project could be dropped directly into Jooomla, but it can't.

To make it work in Joomla you have to create what's called a module. Since I'm not familiar with Joomla, it will take me a long time to get this working the right way as a module.

That is the long term goal, but the client doesn't want to pay the extra money to have this implemented as a module.

Are you familiar with Joomla Mr. Coder?

MrCoder
09-28-2007, 08:25 AM
Nope, but it is PHP.