1
ajaxbr
XOOPS in Frames
  • 2004/6/2 21:52

  • ajaxbr

  • Quite a regular

  • Posts: 276

  • Since: 2003/10/25


This is a very raw idea, but it might be worth developing better.

One of the major problems of frames is that they rarely degrade gracefully (i.e., things break if not accessed from the frameset), mostly due to the fact that they rely on html documents that are meaningless (or flawed) out of the frameset context. However, PHP allows all of the frames' sources to be actually pieces of the same document.

Using conditionals and some frameset variable available to PHP*, one can build a page that renders as a menu bar when called from the left frame and as contents when called from the right frame, and yet renders the whole thing when not in a frameset. It's also a good idea to add the corresponding frame targets to link tags when under a frameset .

Since XOOPS has two design layers well separated from contents, things get much easier

A complete** framing solution in XOOPS would only require a new template (that has no difference from default when not framed) and a wrapper frameset page (that has to set variables/constants that Smarty can understand*). Optionally, a new theme (that has no difference from default or other normal themes when not framed) can be used.

Example of a wrapper menu/contents "frames.php" page:
include "mainfile.php";

echo 
'

'
;

//headerstuff, perhaps Smarty parsed?

echo "
 
    $XOOPS_URL/index.php?XXX_arbitrary_menu_token_XXX' id='menu' scrolling='yes' noresize='noresize' />
 $XOOPS_URL/index.php?YYY_arbitrary_content_token_YYY' id='content' scrolling='yes' noresize='noresize' />
  
<body> <br /><a href='</span><span style="color: #0000BB">$XOOPS_URL</span><span style="color: #DD0000">' target='_top'>Follow this link, oh frameless creature</a> <br /></body>
"
?>


Example of a template conditional (system_block_mainmenu.html):
<{if $smarty.server.HTTP_REFERER == "$XOOPS_URL/frames.php" || $smarty.server.HTTP_REFERER == "$XOOPS_URL/index.php?XXX_arbitrary_menu_token_XXX"}>
    <{if 
$smarty.server.PHP_SELF == "$XOOPS_URL/index.php"}>
<
table cellspacing="0">
  <
tr>
    <
td id="mainmenu">
      <
class="menuTop" href="<{$xoops_url}>/" target="content"><{$block.lang_home}>a>
      
      <{foreach 
item=module from=$block.modules}>
      <
class="menuMain" href="<{$xoops_url}>/modules/<{$module.directory}>/" target="content"><{$module.name}>a>
        <{foreach 
item=sublink from=$module.sublinks}>
          <
class="menuSub" href="<{$sublink.url}>" target="content"><{$sublink.name}>a>
        <{/foreach}>
      <{/foreach}>
      
    td>
  tr>
table>
    <{/if}>
<{else}>
<
table cellspacing="0">
  <
tr>
    <
td id="mainmenu">
      <
class="menuTop" href="<{$xoops_url}>/" ><{$block.lang_home}>a>
      
      <{foreach 
item=module from=$block.modules}>
      <
class="menuMain" href="<{$xoops_url}>/modules/<{$module.directory}>/" ><{$module.name}>a>
        <{foreach 
item=sublink from=$module.sublinks}>
          <
class="menuSub" href="<{$sublink.url}>"><{$sublink.name}>a>
        <{/foreach}>
      <{/foreach}>
      
    td>
  tr>
table>
<{/if}>


However, one might prefer to leave some of the hiding game to themes, like in...

Example of a theme condidional:
<table cellspacing="0">
    <
tr>
<{if 
$smarty.server.HTTP_REFERER == "$XOOPS_URL/frames.php" ||
$smarty.server.HTTP_REFERER == "$XOOPS_URL/index.php?XXX_arbitrary_menu_token_XXX"}>
    <{if 
$smarty.server.PHP_SELF == "$DOCUMENT_ROOT/index.php"}>
       <
td id="leftcolumn">
         
          <{foreach 
item=block from=$xoops_lblocks}>
            <{include 
file="default/theme_blockleft.html"}>
          <{/foreach}>
         
       td>
    <{/if}>
<{else}>
       <
td id="leftcolumn">
        
         <{foreach 
item=block from=$xoops_lblocks}>
          <{include 
file="default/theme_blockleft.html"}>
         <{/foreach}>
        
       td>
<{/if}>


And that's it. Login stuff should have the menu frame as target, I guess. You can create anything from this two-frames to a "header, menu, leftblocks, centerblocks, contents, rightblocks, adspace, shoutbox, footer" setup using this basic idea. Perhaps someone can find a way to get each block as a frame

*There are many ways to set values that Smarty can understand from the wrapper. Check these links for PHP $Server variables, PHP Constants and the {$smarty} reserved variable

**I can't figure out a nice way to make submenus available. Thus this is a very limited "complete" solution

2
ajaxbr
Re: XOOPS in Frames
  • 2004/6/3 1:22

  • ajaxbr

  • Quite a regular

  • Posts: 276

  • Since: 2003/10/25


Random idea: include a "frame me" link in the theme, then build a frameset with the current document as source for the content frame. This will create a bookmarkable frameset, unfortunatelly for that special page only.

Something like (but working):
$curpg $PHP_SELF;
<
a href="$XOOPS_URL/frames.php?$curpg">Frame me!a>


And in frames.php
echo <frame src='$smarty.server.DOCUMENT_ROOT/$curpg&YYY_arbitrary_content_token_YYY'
id='content' />

3
astaldaran
Re: XOOPS in Frames
  • 2004/6/18 21:18

  • astaldaran

  • Just popping in

  • Posts: 73

  • Since: 2004/5/9 1


Well I am new to XOOPS and so am still figuringo ut how everything works but I can see useful uses of frames in xoops. THink about this, you could make each block a seperate frame (with a link to close the frame) and then have in the url variables defined using get to determine if the user once certain blocks open or not. This would be real time since the actualy closing of the frame and such does not require having to burden the server with http hits. However with the variables defined the url XOOPS would know what frames not to open for you.

ps: this is also an undeveloped idea and should probably be worded differently.

4
synistar
Re: XOOPS in Frames
  • 2004/7/30 20:51

  • synistar

  • Just popping in

  • Posts: 18

  • Since: 2004/7/19


My question is why do you need frames. You can achieve similar effects using CSS or Javascript. To me CSS would be the best solution. Check this article out: Ghost in the Box. It shows a frames styled layout that uses only CSS. This gets rid of all the problems with frames and avoids all the PHP and theme hacking to get frames working.

I think that frames cause too many problems for users to make them worthwhile except in very limited situations.

5
jmass
Re: XOOPS in Frames
  • 2004/7/30 21:52

  • jmass

  • Friend of XOOPS

  • Posts: 524

  • Since: 2003/12/18


There is no use that frames serve that can not be done differently. There are far too many disadvantages of frames and zero advantages.

The only use I can possibly see is for a web application that may use frames. I have seen a couple that are not bad. However, I come back to the fact that the same thing could have been accomplished without frames.

JMass

6
ajaxbr
Re: XOOPS in Frames
  • 2004/7/30 23:37

  • ajaxbr

  • Quite a regular

  • Posts: 276

  • Since: 2003/10/25


Quote:

jmass wrote:
There is no use that frames serve that can not be done differently. There are far too many disadvantages of frames and zero advantages.
Thanks a lot for your reply

My interest in frames comes from not being able to find another way to avoid data transfer for, say, a navigation menu or a static banner every time the actual contents change. I'll be toying with this frames idea in a few days, if you can suggest a better way to achieve that, it'll save me from some worthless effort

7
synistar
Re: XOOPS in Frames
  • 2004/7/31 15:34

  • synistar

  • Just popping in

  • Posts: 18

  • Since: 2004/7/19


If bandwidth savings is your goal then frames has very little advantage for you. Since banner images would be locally cached anyway the only thing you save would be your nav-bar markup. You would get much more bandwidth savings from an all CSS layout (that caches all layout elements locally) than from a frames based approach which would force you to remove any dynamic elements from the frame you want to stay cached.

Either way, good luck with your layout.

Login

Who's Online

261 user(s) are online (144 user(s) are browsing Support Forums)


Members: 0


Guests: 261


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits