A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Replacing Frames with PHP... Is it REALLY possible?

  1. #1
    Member Manic_Man's Avatar
    Join Date
    Dec 2007
    Location
    Hastings, England
    Posts
    91

    Question Replacing Frames with PHP... Is it REALLY possible?

    Replacing the so called 'Evil' frames with PHP is possible in many cases where people can use include statements if they just want a simple header or a menu on each page, but for some more advance cases, i have yet to see anyone answer a few fairly simple questions..

    On AppTools.com, the owner is the one person i have seen that comes close to the question i have in mind when he wrote "The novice web designer often thinks that by only changing a portion of the page, they will save download time for the user, since only part of the page has to be downloaded. That's myth number one".

    Now. In my case, and this will lead to the question, the site is basically like a screen with the frame in the middle of it, which display the current pages data (Http://www.TESP.co.uk by the way). True, it limits browser space with this set up but i like it and it's perfectly find for things. The main page is a little full with a the header, menu bar, links etc. Now, As i understand it currently, if i use include statements, i would have to get the user to reload the top header and everything each time they visit a new page. This takes up bandwidth and time, slowing down the sites loading. However, as you notice from the quote i posted, this guy seams to say it's a myth and for some reason, include lines don't mean you have to reload the data. In theory, files are cashed so it doesn't have to reload images once it has them, though in practise it seams to be a little different from that.

    IS it truly possible that PHP can somehow save bandwidth or use up the same amount via include lines as if the outer frame wasn't being reloaded all the time (which it isn't if it stays the same), or is this guy mistaken? OR, Is it in fact possible to use some dynamic PHP script that will, in fact, allow a frame like system to just change the centre pages include address when needed? If i make myself clear.. If i don't, just ask for more information, I'm more then happy to give it.

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    Yes, the person you're quoting is right, includes and images will be cached and after the first page loads, performance will be better. However, it seems that's not really what you're talking about. What you seem to be hoping to avoid is the page refresh, where when you navigate to a new page, everything goes blank for a second. This happens because when you navigate to a new page, the browser has no idea what it's going to get, and which elements are the same from the previous page.

    You ask whether you could just use PHP to change the include. Yes and no. In general, PHP just spits out HTML. It doesn't know how to take what you're currently viewing, and only replace part of it without refreshing the page. So how would you do that? Well, you could use AJAX, which is the combination of Javascript and a server side language like PHP. You could use javascript to ask PHP for a bit of HTML, and then replace the appropriate portion of the page.

    AJAX has its own issues, and I wouldn't recommend it just to avoid page refreshes. Page refreshes are an inevitable part of the web.

    You can minimize the effect of page refreshes by following good coding practices, which in your case would be avoiding tables for layout (a table must completely download before it displays), and avoiding inline javascript and CSS (adds to the HTML, which slows page downloading and rendering).

    Or, if you're hellbent on avoiding page refreshes altogether, you can always keep things as they are.

  3. #3
    Member Manic_Man's Avatar
    Join Date
    Dec 2007
    Location
    Hastings, England
    Posts
    91
    well, i knew it wouldn't stop the flashing for loading pages but while i find images do seam to load faster the second time, there is still a noticable delay for them to load which slows things down, and for larger files, it seams to take much longer which kinda defeats the idea of cashing a bit for me..

    I had looked at Ajax but it never seamed to be that great.

    And i must admit for all the time i've been doing HTML, i have been stupid and never quite noticed that tables need the whole thing to load first before displaying.. I've been meaning to upgrade from tables for some time.. Guess it's time i do that ^_^ Thanks for your help.

    Didn't think CSS slows down a page much.. always been told it's better to use a CSS then do things 'normally'...

  4. #4
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    It's not CSS that slows things down (CSS is a very good thing!), I meant inline stuff like style="whatever" type stuff, or not using CSS when you could be:

    Code:
    <td width="17" valign="top" bgcolor="#000000" background="SiteImages/rightside_wood.jpg">
    Could be:

    Code:
    <td class="right">

  5. #5
    Member Manic_Man's Avatar
    Join Date
    Dec 2007
    Location
    Hastings, England
    Posts
    91
    ah.. intresting..

    Oh, So really, tables are still needed if you do mutliple cells like
    [cell1][cell2][cell3]
    [cell1][cell2][cell3]
    type of set up, but the propertys should be Css?

  6. #6
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    Oh no, you can do almost any layout without tables. You should use tables for tabular data, something with columns and rows and headings and all that.

    I was just using the above to say all your CSS should be in an external CSS file, rather than mixed with the code of the page.

  7. #7
    Member Manic_Man's Avatar
    Join Date
    Dec 2007
    Location
    Hastings, England
    Posts
    91
    ah.. okay.. i think i got it now..

    I do have some nice 'frames' in the term like a picture frame, where a table is set up like this;

    [o][-][o]
    [|][X][|]
    [o][-][o]

    where X is whatever data is needed and the o - and | are the frame graphics.. I think it might be an idea to mix css with a php function so i can just say 'Call frame(Data)' etc.. shouldn't be too hard and should make that fairly easy.. you can't store functions in a css i take it? kinda stupid to think you can but.. just wondering ^_^;

  8. #8
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    No, you can't store functions in CSS.

  9. #9
    Member Manic_Man's Avatar
    Join Date
    Dec 2007
    Location
    Hastings, England
    Posts
    91
    didn't think so and my messing about converting more complex frame sets to css is mixed.. Oh well, i can handle basic stuff now so that's okay. Thanks, i've already noticed speed improvements ^_^

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center