The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 12 of 12

Thread: PHP Frame Emulation

  1. #1

    PHP Frame Emulation

    Hi all,

    I am new to this forum and was wondering if anyone could help.. I want to construct a HTML website that utilises PHP to emulate a Frameset, I have so far succeeded with one main area in which the content changes, by using the following method:

    if (!isset($_GET['page'])) $page= 'printer'; else $page= $_GET['page'];
    switch($page)
    {

    case 'crow': include ('characters/crow.php');break;
    case 'glo_kock': include ('characters/glokock.php');break;
    case 'iolo':include ('characters/iolo.php');break;
    case 'malog':include ('characters/malog.php');break;

    }

    What I am trying to achieve is to have two areas in the same page in which information can be loaded in indipendently of each other

    Is this possible? (My PHP knowledge is extremely limited)

    Best Regards

    Alexis

  2. you could it like this:
    PHP Code:
    <?php
    //Set variables, feel free to add more, just change the other code to suit.
    if(isset($_GET['page'])) { $page $_GET['page']; } else { $page 'home'; }
    if(isset(
    $_GET['scheme'])) { $page $_GET['scheme']; } else { $scheme 'default'; }
    //include header and main content with correct page and scheme
    include ('header.php?page='.$page.'&scheme='.$scheme);
    include (
    'content.php?page='.$page.'&scheme='.$scheme);
    ?>
    Then in header.php you would have something like this:
    PHP Code:
    <?php
    //Set variables
    $page $_GET['page'];
    $scheme $_GET['scheme'];
    /*******************************/
    /*           Content Variables                  
    Place all your variables and code for grabbing data here, I have just used $title for title $scheme for style and $content for content and $page for page. */
    /*******************************/
    ?>
    <html>
    <head>
    // CSS Include goes here (I have forgotten it so sorry)
    <title><?php echo $title?></title>
    </head>
    <body>
    <div id="header">
    //Insert your header code here
    </div>
    Then in content.php you have similar, im actually out of time on comp so when I get home I will write up a beter example of how you would do something like this
    Last edited by evildrummer; April 22nd, 2007 at 04:06 AM.


  3. #4
    Thanks for this its a great help, I think I understand this, I'll have a play with it and see if I can implement it.

    Cheers

    Lex

  4. #5
    Hi again ,

    I have tried to implement the code that you kindly posted, I does not seem to work though unfortunately..

    The browser returns the following:

    Parse error: parse error, unexpected T_ELSE


    I have literally pasted the code to try it before I attempt to construct it to my own uses.. and it only returns the above..

    A clear indicator of what I am trying to achieve can be seen at my website

    http://www.theswingingseesaw.com (click on html lite)

    I have two key areas, one for a small news blogger, and the other for the main content... This works ok for now, but eventually I want users to be able to change the content in the news division, and the main division independently of each other on the same page...

    Thanks Again

    Best Regards

    Alexis

  5. I see the error, I have edited my post to fix it, (well not yet, refresh in 3 minutes)

  6. #7
    Ahh a missing bracket... Thats great this script works now......

    Apologies for my lack of PHP understanding, I am only just beggining to somewhat understand it..

    Does this method allow users to change the content in dynamically in seperate divisions with hyperlinks?

    The method I was using would only seem to let me change the content in one div at a time, knocking the content out of the other altogether..

    I tried implementing the following....

    (Main content Frame)

    <div id="fauxframe">

    <?php
    if (!isset($_GET['page'])) $page= 'web_news'; else $page= $_GET['page'];
    switch($page)
    {

    case 'crow': include ('characters/crow.php');break;
    case 'glo_kock': include ('characters/glokock.php');break;
    case 'iolo':include ('characters/iolo.php');break;
    case 'malog':include ('characters/malog.php');break;
    case 'princess':include ('characters/princess.php');break;
    case 'secondsight':include ('characters/second.php');break;
    case 'snorkel':include ('characters/snorkel.php');break;
    case 'squidsac':include ('characters/squidsac.php');break;
    case 'truckr':include ('characters/truckr.php');break;


    }
    ?>

    setting my hyperlinks up as...

    <a href="seesawlite.php?page=crow">Characters</a>

    To change the main content in the main window,

    But I also wanted another window on the same page to be equally as dynamic, allowing users to update content in a seperate div using the same method...

    So I set up the following code within the appropriate div

    <div id="rssinner">

    <?php
    if (!isset($_GET['file'])) $file= 'rss_april; else $file= $_GET['file'];
    switch($file)


    case 'rss_april':include ('news/seesawnews.rss);break;
    case 'rss_march:include ('news/march.rss);break;
    case 'rss_feb':include ('news/february.rss');break;


    }

    Using the following hyperlink structure to call the 'file' pages


    <a href="seesawlite.php?file=rss_march">March</a>


    Doing all of the above only allows the loading of one section at a time, knocking the other one out to nothing...

    What I am looking for is to have both windows with the appropriate content displayed at the same time...

    I thought it might be something to do with the link structure and tried to set the links up in the following structure:

    <a href="seesawlite.php?file=rss_march?page = #">March</a>

    But it doesnt work...

    Thanks again for your help, and apologies for my novice PHP understandings

  7. When making the links I would have it like this:
    PHP Code:
    <?php
    //Current Header(File 1) is set to Home, Content (File 2) is set to another page (lets call it about)

    //this would actually already be set but im redefining it to make it clear
    $header 'home';
    $content 'about';

    //Now if we wanted to link the header to say a page called product we would do this:
    ?>
    <a href="http://example.com/index.php?page=<?php echo $page?>&header=product">Example Link</a>
    <?php
    //you could also reverse it so you are changing the page and keeping the header or changing both, buy just mixing around the code.
    ?>
    If you need more help just say,

  8. #9
    Hi again,

    thanks for the help with this stuff... I kinda understand it, but not enough to implement to what I am doing unfortunately..

    Is there perhaps a way for me to change the XML file in my RSS parser without it directly affecting the main content generated by the dollar $page content of my current script?

    http://www.theswingingseesaw.com/sit...seesawlite.php is the layout example i'm currently describing..

    I want the users to be able to recall RSS archives in the green left column, whilst not effecting the content called into the main pink window to the right

    currently the file for the RSS parser that I am using is set up like so:

    $file = "swingingseesawnews.rss";

    Thanks again for your input, it is much appreciated

    I have searched and searched for info on query strings, but they all reveal the basic method I am already using


    Cheers Lex

  9. Give me an example of how you are currently using links and what they need to be formatted like and I will write the code, Im absolutely shattered (not slept in lik 36 hours) so have no idea what needs to be done, so the simpler the better, the code should be simple for me (code just makes sense)

  10. #11
    Cheers Dude,

    Your help is much appreciated... Its great to see that experienced coders r willing to share their knowledge...

    I can e-mail you the current files I am using, If thats ok with you?

    Again your help is greatly appreciated.

    Cheers

    Lex

  11. yeah sure, my email is stuart.loxton@googlemail.com and experienced isnt what I would call myself, just experimental and a hobbyist (for now)

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
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012