Page 1 of 3 123 LastLast
Results 1 to 10 of 28

Thread: Is it possible to pass a parameter to an iFrame?

  1. #1
    Senior Member Adendum's Avatar
    Join Date
    Apr 2010
    Location
    London (UK) & Granada (Spain)
    Posts
    926

    Default Is it possible to pass a parameter to an iFrame?

    I have a NOF11 page that calls in an iFrame from another site. Both sites are owned by the client but are on different domains and different servers.

    What I am looking for is a way to pass the parameters (hard coded in the navigation = AWM) and call in the content from the "iFramed" site using just one iFrame page in NOF.

    For example to pass this parameter "?sid=62465&search[text]=cool" (no quotes) from the menu would open page A. Page A has a php include of page B (the iFrame content) so the iFrame call is changed to add ?sid=62465&search[text]=cool and displays content that is 'cool'. But from another AWM button I pass the parameter "?sid=62465&search[text]=hot" (no quotes) and that also opens the same page A but the iFrame call is amended and calls in just the 'hot' content.

    Doable? How?
    Paul - Aditerum Ltd and AllSortsOfStuff Ltd
    NOF11 (in Admin mode!); Vista Premium 64bit; AMD Phenom IIx4 945 Processor 3.00Ghz; 8.0Gb RAM
    Wouldn't it be great if there was only a single browser to worry about!!!

  2. #2
    Senior Member gotFusion's Avatar
    Join Date
    Jan 2010
    Location
    www.gotHosting.biz
    Posts
    4,529

    Default

    You can pass parameters in the URL but it is up to the receiving page to deal with the parameter.

    http://www.domain.com?param1=cool&param2=grovey You can add as many to the URL as you wish by just appending &param=xx The gotFusion tutorials display using this method http://www.gotfusion.com/tutorials/tut.cfm?itemID=4072 (notice the ? and itemID= that is the passed parameter). As long as the item that is being passed is not critical (i.e don't send credit cards numbers or any sensitive data as part of a URL as they are exposed)
    NetObjects Fusion Cloud Linux enabled Web Hosting, support + training starts at $14.95
    NetObjects Fusion web Hosting and support + ASP + PHP + ColdFusion + MySQL + MS SQL
    FREE NetObjects Fusion Support & training comes with all web hosting accounts
    NetObjects Fusion Web Hosting: http://www.gotHosting.biz

  3. #3
    Senior Member Adendum's Avatar
    Join Date
    Apr 2010
    Location
    London (UK) & Granada (Spain)
    Posts
    926

    Default

    I'm probably not explaining myself very well here. I'm OK with the parameter syntax but....how do I do that in NOF when the NOF page includes another page that is an iFrame?

    I'm OK with the AWM link of "http://www.domain.com?param1=cool&param2=grovey" but the page this calls (index.php) which is actually made up of two NOF pages - index.php which has an include of content.php and content.php is the iFrame. So I need to append the ?param1=cool&param2=grovey to content.php. BUT I can't edit content.php to force it to always call it's wrapper page (index.php) using (top.location.href!="http.....). So what I think I want is for my index.php page to take the parameter ?param1=cool&param2=grovey and append it to the iFrame call.

    In NOF the page content.php is simply a layout area with an iFrame that looks like "http://subdomain.domain.com/" what I need is to have that dynamically change to http://subdomain.domain.com/?param1=cool&param2=grovey

    Impossible?
    Paul - Aditerum Ltd and AllSortsOfStuff Ltd
    NOF11 (in Admin mode!); Vista Premium 64bit; AMD Phenom IIx4 945 Processor 3.00Ghz; 8.0Gb RAM
    Wouldn't it be great if there was only a single browser to worry about!!!

  4. #4
    Senior Member gotFusion's Avatar
    Join Date
    Jan 2010
    Location
    www.gotHosting.biz
    Posts
    4,529

    Default

    If you take the passed parameter and store it as a variable then pass the variable along to the final page. Using a variable as the intermediary will allow any parameter to be passed as it is not an absolute and can contain any of the absolute URL parameters that are passed through it.
    NetObjects Fusion Cloud Linux enabled Web Hosting, support + training starts at $14.95
    NetObjects Fusion web Hosting and support + ASP + PHP + ColdFusion + MySQL + MS SQL
    FREE NetObjects Fusion Support & training comes with all web hosting accounts
    NetObjects Fusion Web Hosting: http://www.gotHosting.biz

  5. #5
    Senior Member Adendum's Avatar
    Join Date
    Apr 2010
    Location
    London (UK) & Granada (Spain)
    Posts
    926

    Default

    You totally lost me now....

    There's no database involved here. Just the parameter hard coded into an AWM button, an index.php page that includes another page called content.php.
    Paul - Aditerum Ltd and AllSortsOfStuff Ltd
    NOF11 (in Admin mode!); Vista Premium 64bit; AMD Phenom IIx4 945 Processor 3.00Ghz; 8.0Gb RAM
    Wouldn't it be great if there was only a single browser to worry about!!!

  6. #6
    Senior Member gotFusion's Avatar
    Join Date
    Jan 2010
    Location
    www.gotHosting.biz
    Posts
    4,529

    Default

    You sure you don't want to know how to remove underlines from links instead

    You are starting with an absolute parameter as part of the URL (parm=TEXT). You need to store that absolute text within in a variable so no matter what comes in on the URL (each link coming in could have a different parameter passed with it) your output to the 3rd page will be whatever comes in (regardless of what comes in). You can put anything into a variable. SO for example one page comes in and the passed URL parameter is "wowzers", that goes into your variable and the variable is passed to the 3rd page so wowzers gets passed. A second page comes in and the URL passed parameter is yep, that goes into the variable and yep gets passed to the 3rd page as the same variable name so your code is reusable, just the content of the variable changes, it still goes to the 3rd page. This is just the concept part of what you want to do.

    In PHP I think you could do this by using a php session. Take a look at this page and see if it helps you http://www.tizag.com/phpT/phpsessions.php

    It has been over 10 years since I did any serious work in PHP and a lot has changed since then. Most of my old coding is archived on my NAS and for the past couple of weeks I have been sort of all apart here.... http://www.gotfusion.com/myMess.jpg
    NetObjects Fusion Cloud Linux enabled Web Hosting, support + training starts at $14.95
    NetObjects Fusion web Hosting and support + ASP + PHP + ColdFusion + MySQL + MS SQL
    FREE NetObjects Fusion Support & training comes with all web hosting accounts
    NetObjects Fusion Web Hosting: http://www.gotHosting.biz

  7. #7
    Senior Member Adendum's Avatar
    Join Date
    Apr 2010
    Location
    London (UK) & Granada (Spain)
    Posts
    926

    Default

    Thanks Mike,

    It turns out the solution was easier than I expected , courtesy of a well directed link from Mike.

    The only change in NOF was to name the iFrame, although this wasn't necessary really as I could have used the default name, but I named it "frame_name" anyway.

    In AWM I created buttons with links as follows:-
    Code:
    http://subdomain.domain.com/shop.php?sid=594631&search[text]=heart
    http://subdomain.domain.com/shop.php?sid=594631&search[text]=club
    http://subdomain.domain.com/shop.php?sid=594631&search[text]=diamond
    http://subdomain.domain.com/shop.php?sid=594631&search[text]=spade
    and used the "link target" of an iframe with a specified name of "frame_name" to match the NOF page that calls in the iFrame from http://subdomain.domain.com.

    I tested the process using simple html before coding AWM, so, for non AWM users, who want to have a page that includes an iFrame but pass a parameter to it you can also use a standard href to achieve the same thing, as per the example I stole from...

    <a href="http://www.google.com" target="frame_name">Google.com</a><p>
    <iframe src="http://www.yahoo.com" name="frame_name" width="100%" height="90%"></iframe>

    If someone needs to do the same and doesn't understand my explanation just shout.
    Paul - Aditerum Ltd and AllSortsOfStuff Ltd
    NOF11 (in Admin mode!); Vista Premium 64bit; AMD Phenom IIx4 945 Processor 3.00Ghz; 8.0Gb RAM
    Wouldn't it be great if there was only a single browser to worry about!!!

  8. #8
    Senior Member gotFusion's Avatar
    Join Date
    Jan 2010
    Location
    www.gotHosting.biz
    Posts
    4,529

    Default

    Glad the link helped you get sorted out.

    Send me a URL when you have it up and running as I would like to see the end results.
    NetObjects Fusion Cloud Linux enabled Web Hosting, support + training starts at $14.95
    NetObjects Fusion web Hosting and support + ASP + PHP + ColdFusion + MySQL + MS SQL
    FREE NetObjects Fusion Support & training comes with all web hosting accounts
    NetObjects Fusion Web Hosting: http://www.gotHosting.biz

  9. #9
    Senior Member Adendum's Avatar
    Join Date
    Apr 2010
    Location
    London (UK) & Granada (Spain)
    Posts
    926

    Default

    Mike,

    The site is up and running and is live .... although it is still a work in progress. Yikes!

    Be aware that the site also uses the geo location code (see thread) so what you see will be different to what someone in Europe sees. In effect there are two home pages (indexuk.php and indexus.php), so when you visit the domain's index.php it will route you to the US version. But you can easily see the differences by changing the url in the address bar from .com/indexus.php to .com/indexuk.php.

    The parameter passing stuff happens from the AWM menu under the heading DESIGNS.

    So everyone starts at http://www.nutspokerclothing.com

    Don't forget - still a work in progress!! So the client is adding designs and products every day and I'm tweaking AWM and the odd site page too.
    Paul - Aditerum Ltd and AllSortsOfStuff Ltd
    NOF11 (in Admin mode!); Vista Premium 64bit; AMD Phenom IIx4 945 Processor 3.00Ghz; 8.0Gb RAM
    Wouldn't it be great if there was only a single browser to worry about!!!

  10. #10
    Senior Member wtpooh55's Avatar
    Join Date
    Jul 2010
    Location
    Atlanta, Georgia USA
    Posts
    134

    Default

    Hey Adendum, I know you said it is a work in progress, but here on the other side of the pond, it is not redirecting to the US side. Just thought I'd give you a heads up.

    Looking good though.

    David

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •