Results 1 to 6 of 6

Thread: dynamic iframes?

  1. #1
    Join Date
    Oct 2009
    Posts
    9
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Unhappy dynamic iframes?

    I simply want to install iframes on my popup windows that will display my php form/table app. The issue I'm having is that the iframe url will vary depending on the user logged in as the app is pulled from that user's directory. So instead of a nice clean url it has to be something like this "http://www.mysite.com/directory1/directory2/" . $User ."/app.php"

    I'm sure whatever needs to be done here is simple enough, but after scouring all the forums and how-to articles I have since spent the great deal of my time pulling out my hair. I am now bald and looking for someone to bail me out, I just have no idea how to put this code all together.

    Any help would be greatly appreciated! An actual working code would be beyond excellent! Thank you so much in advance!
    Last edited by oldtimer; 10-08-2009 at 05:08 PM.

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    if you're using php already, do you really need iframes? Just write your dynamic url in the popup link and open the desired page directly:
    PHP Code:
    <a href="http://www.tosengine.com/NFDocuments/AS9100/<?php echo $User?>/app.php">popup link</a>

  3. #3
    Join Date
    Oct 2009
    Posts
    9
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Thanks!

    Thanks for your reply! That's definitely a way of going a way of going about it! I think I just got hung up trying to do the iframes because I wanted to have some display properties that would be easily achieved by doing it that way. But now that you mention it, with this iframe issue giving me such a headache, it may be easier to set it up your way.

    I'm a bit knew to PHP (if you can't tell) so your help in this is really appreciated!

  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    if you're really set on using iframes (and I don't recommend it - they're a pain and accomplish nothing you can't do through php and css), I think it could work like this:
    page.php
    PHP Code:
    <?php session_start(); // this line MUST be the first line on the page!  NOTHING above it!
    $_SESSION['user'] = $user//set $user info from this page to be available to session, if not already done
    ?>
    <a href="/path/to/popup.php">popup link</a>
    popup.php
    PHP Code:
    <?php session_start(); //see comment above
    ?>
    <iframe src="http://www.tosengine.com/NFDocuments/AS9100/<?php echo $_SESSION['user']; ?>/app.php"></iframe>
    this could also be done through $_GET or $_POST, but I think $_SESSION would be best in this case, as user information is usually useful/needed across several pages anyway.
    Last edited by traq; 10-08-2009 at 08:37 PM.

  5. #5
    Join Date
    Oct 2009
    Posts
    9
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Thanks (again)!

    Yeah, I know the iframes are a pain and I think I will try to work around it as you suggest know that I think about it.

    Still, thank you very much for going ahead and giving me the iframe too so I can always do it the way I was planning if I need to!

  6. #6
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    no problem; it should work fine but it's not tested. never done it that way before.

Bookmarks

Posting Permissions

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