Link to home
Start Free TrialLog in
Avatar of rblampain
rblampain

asked on

PHP, Javascript & frames

I have a number of users who need the ability to edit an undefined number of files at the same time. This involves dividing the screen space into 2, 3, 4 or 6 windows so that a user can view all the files to be edited at the same time. If the user wants to edit more than 6 files at the same time then each file is presented in a fixed size "textarea" which will toghether occupy more than the screen space and scroll as a block.

I already have  tested "HTML frameset" for the purpose and what I need is  a PHP script that creates these framesets and displays in the frames the contents of the files to be edited (in textareas ?) then saves the files when editing is completed.

The files to be edited are already selected and the full paths are retrieved from an array from a previous PHP script. So this array is to be passed between scripts with the "PHP session".

With the basic PHP knowledge I have I can spend days in trial and error on this. I thought someone more experienced could give me a more efficient script to do this.

Thank you for your help.
ASKER CERTIFIED SOLUTION
Avatar of Marcus Bointon
Marcus Bointon
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rblampain
rblampain

ASKER

Thanks to Squinky.
I didn't know anything about "iframes", I thought it was a MS thing, I use Linux.
My browser seems to support it but it's a bit more learning for me and I'd prefer to avoid it, I already have the html framesets ready and tested.
It looks like "frameset" will give me better control of the screen real estate, if this is correct then I won't use "iframe".  
It seems I can use parts of the scripts you provide but it's not really the solution I need. I'll wait a couple of days and if no other solution is  coming I'll try to adapt it to my needs.
iframes are part of W3C standard HTML, nothing particularly proprietary about them, and they're supported by all browsers. Their main advantage is that you don't have to use framesets - they act just like a div that happens to display content from elsewhere, so are easily styled and laid out using CSS.

Using regular frames is not hugely different to code. The editor page will remain the same, but the frameset generation could be:

<html>
<head><title>Editing file <?php echo $filename; ?></title></head>
<?php
$rows = repeat(100/count($_SESSION['files']).'%,', count($_SESSION['files']));
$rows = substr($rows, 0, -1); //Strip trailing comma
echo "<frameset rows=\"$rows\">\n";
foreach($_SESSION['files'] as $file)
  echo "<frame src=\"edit.php?file=$file\" />\n";
?>
<noframes>
<body>Your browser does not handle frames!</body>
</noframes>
</frameset>
</html>

As you can see, frameset syntax is noticeably more complex than iframe. The layout is fixed by the HTML (thus losing semantic markup value), and you can't lay it out with CSS. There's good info here: http://www.w3schools.com/html/html_frames.asp
It will probably take me a few weeks to finalize this script so I gave your solution a "B" grade although it may deserve better.