Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Feb 2003
    Posts
    11
    Member #
    626
    Does anyone know whether it's possible to write directly into a frame during the frameset-creation time? I have a PHP script that produces a frameset, but would like to be able to output contents to each frame at that moment as opposed to re-calling the script for each frame.

    Something like:
    Code:
    <HTML><HEAD><TITLE>Frames</TITLE></HEAD>
    <FRAMESET ROWS="10%,10%,*">
      <FRAME NAME=FRAME1>
        <HTML>
          <HEAD>
            <SCRIPT SRC="jsfcns.js" LANGUAGE="javascript"></SCRIPT>
          </HEAD>
          <BODY></BODY>
        </HTML>
      </FRAME>
    
      <FRAME NAME=FRAME2>
      </FRAME>
    
      <FRAME NAME=FRAME3>
      </FRAME>
    </FRAMESET>
    </HTML>
    I tried this, but it doesn't seem to work. Any ideas, or can this even be done?

    Thanx,

    - skubik.

  2.  

  3. #2
    Senior Member visualAd's Avatar
    Join Date
    Jan 2003
    Location
    Slough, UK
    Posts
    201
    Member #
    434
    I don't think that is possible as the reason behind frame sets is to allow different pages to be displayed in one HTML window. If the content inside the frame set was static then you would not be able to navigate to a new page in that frame.

    You can however set the frames src properties to the same PHP script with the addition of a query string.

    PHP Code:
    <?php
    /*
      This document creates an HTML frame set. All the inital frame resouces are contained in this
      document.
    */

    $this $_SERVER['PHP_SELF']; // add a reference to this script


    if (! isset ($_GET['frame'])){ // display the frameset first ?>
    <frameset cols="15%,*">
      <frame src="<?php echo("$this?frame=left"// ensure the src property is set to this document ?>" name="left">
      <frameset rows="15%,*">
        <frame src="<?php echo("$this?frame=top"?>" name="top">
        <frame src="<?php echo("$this?frame=right"?>" name="right">
      </frameset>
    </frameset>
    <?php
     
    } else
       
    showframe($_GET['frame']);

    function 
    showframe ($name) {
    /*
      This function executes the function to deal with a particular frame. If the function does not exist
      it returns a 404 error to the browser
    */

      
    if (function_exists ($name))  // execute a function to display the frame
        
    $name ();
      else 
    // no frame found return a 404 error
        
    header("HTTP/1.0 404 Not Found");
    }

    /* the functions here deal with individual frames - the name of the function must correspond to the
       value passed to the frame get variable in the query string
    */
    function top () {
      echo (
    "This is the TITLE BAR");
    }

    function 
    right () {
      echo (
    "This is the MAIN WINDOW");
    }

    function 
    left () {
      echo (
    "This is the CONTENTS BAR");
    }
    ?>
    Here the whole frameset and its frames are included in the main document. A rethink is required as to the order in which the document is diaplayed. Remember that each frame should be treated as a different document. If you are concernd about the persistance of variables between the frames this can be done easily by saving files containing them to the server or through the url query string.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 08:44 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com