Results 1 to 5 of 5

Thread: Do I need an alternative to iFrame?

  1. #1
    Join Date
    Apr 2008

    Do I need an alternative to iFrame?

    At the moment I have a page which basically pulls the information from a File in the /Upload folder in my FTP... But the iFrame is presenting some issues:


    If I mouse-over the text and I scroll up/down, I don't have a problem, but if I move my mouse to the right into the blank space and I attempt to scroll up/down, the page becomes incredibly short. I would assume this is because the object being used on this page in an iFrame. Do I need to use an alternative to the iFrame? Or do I just add something to my code?

    HTML Code:
    $data=mysql_fetch_assoc(mysql_query(sprintf("select * from  game_guide where id='%s'",$_REQUEST['id'])));
        $dataadsense=mysql_fetch_assoc(mysql_query(sprintf("select * from adsense where user_id='%s'",$user_id)));  
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    <html lang="en">
    <title>GameSave.me (FAQ/Walkthrough) - Monetize your Game Guides!</title>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <link rel="stylesheet" type="text/css" href="css/style_sticky.css" />
    <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
    <div id="fb-root"></div>
    <script>(function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) return;
      js = d.createElement(s); js.id = id;
      js.src = "//connect.facebook.net/en_IN/all.js#xfbml=1&appId=545106498912954";
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>
    <div class="header">
      <div id="top">
        <div class="logo"><a href="index.php"><img src="images/logo.png" alt="" /></a></div>
        <div class="search_bar">
            <?php echo stripslashes($dataadsense['header']); ?>
      <div style="clear:both;"></div>
      <div class="mainnav">
         <div class="fb-like" data-href="http://gamesave.me/guide-details.php?id=<?php echo $_REQUEST['id']; ?>" data-layout="standard" data-action="like" data-show-faces="false" data-share="false"></div>
        <a href="https://twitter.com/share" class="twitter-share-button" data-lang="en">Tweet</a> 
        <div class="g-plusone" data-size="medium"></div>
        <script type="text/javascript">
      (function() {
        var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
        po.src = 'https://apis.google.com/js/platform.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
      <div style="clear:both;"></div>
      <div class="content_box">
    <?php if($data['guide']){ ?>
    <p style="overflow-y: hidden;"><iframe src="upload/<?php echo $data['guide'];?>" width="1600" height='1200' frameBorder="0"></iframe></p>
        /*$myFile = "http://vtdesigns.in/projects/savegamenew/upload/".$data['guide'];
        $fh = fopen($myFile, 'r');
        $theData = fread($fh, 5000000);
        echo $theData;*/
    <?php }?></div>

  2. #2
    Join Date
    Feb 2014
    First issue is you're using mysql, when you should use either mysqli or PDO to read from your database if you want it to be accessible in the future.

    An alternative to using iFrames in your case would be to wrap an include statement in a <div>, then you can make it scrollable or manipulate it however you like, especially if you want to organize the sections in a specific way. You'll find it's much easier, both in terms of styling, maintaining and from the user's experience, there won't be the issue you're having right now.

    HTML Code:
    // some code
    <div id = "myContainer">
       // include("someFile.php");
       // OR
      // read from your MySQL database

  3. #3
    Join Date
    Apr 2008
    I didn't code this webpage... So all I need to do is replace the iframe code with the <div id> and the php include?

  4. #4
    Join Date
    Mar 2005
    Behind you...
    For the sake of full clarity, the reason for issue you observed in your original post is because of the width and height set on the iframe on the page. If you are on a resolution with a width lower than 1600 pixels (or shrink your browser window) you'll find that you cannot replicate what you described (using the mouse wheel to scroll). On higher resolutions you run into that problem because when you place your mouse on the far-right side of the screen you are no longer scrolling the iframe, but the outer page itself (which is a much shorter page as it doesn't scale to fit iframe content).

    This could be corrected in some sense with simple CSS modifications. Simply setting the width of the iframe to 100% (rather than an absolute 1600 pixels) will have the iframe scale horizontally. But as I dig into the code more I can see that it looks like you'd need to adjust a fair bit of your template in the end.

    You can also use Error404's method of simply including the file directly rather than displaying it in a frame. This will mean the element you place it inside of will probably work out a bit better, but again it will come down to your CSS. The main takeaway might be that you will have an easier time dealing with the vertical scrolling replacing the frame with a <div> and including the file. But if anyone chooses to view the page in a browser window under 1200 pixels (the <p> element outside of the iframe also seems to have a fixed width) both methods will give the user annoying scrolling issues.
    "Given billions of tries, could a spilled bottle of ink ever fall into the words of Shakespeare?"

  5. #5
    Join Date
    Mar 2014
    Yes, it's clearly due to a size box problem.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.10062 seconds
  • Memory Usage 2,897KB
  • Queries Executed 15 (?)
More Information
Template Usage (33):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (2)bbcode_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (5)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (72):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates