Web Design Question - iframe or alternative

By Blind Dragon ยท 6 replies
Nov 7, 2008
  1. I have integrated phpbb3 into a CMS script. Meaning when a member joins my site, they automatically get an account in the phpbb3 forums. Now the problem is currently the forums load externally to the CMS, then I added a link back to the main site.

    I would like to fully integrate it. So I tried created a page named forum.php and used an iframe to bring the forums within the content area of the CMS. The problem is the height issue. I get scroll bars on the forums and on the browser (2 sets of scroll bars) This makes usability horrible.

    I am looking for an alternative to using the iframe. Or a fix to dynamically set the height of the iframe to adjust the iframes content. I would just set height to 1500px but then on a short page there is a ton of wasted space. height="100%" wont work, with iframes you can only set the width to 100%. So what to do?

    I was thinking of using javascript to determine the page height, then call the iframe and have it pull the height from the script?

    I was curious how VB is integrated into contenteller here at techspot? Is it using an iframe with javascript
  2. jobeard

    jobeard TS Ambassador Posts: 11,124   +982

    Instead of IFrame, use Framesets in which on frame is used for the phpbb3.
    The frameset would be used in the reply from the sign-up to your site.

    You will/have created a cross-domain presentation with either approach and most browsers now warn the user.

    A means to avoid this would be
    • set a cookie when signup is achieved
    • look fro the cookie as a trigger to add a menu or link to phpbb3
  3. Blind Dragon

    Blind Dragon TS Evangelist Topic Starter Posts: 3,908

    Thanks man, I am not familiar with framesets. This is the code I am doing it with now, could you help me with how I could do it with a framesets instead of the iframe, and with frameset would I have a scroll bar or would the boxes content fit-to-height dynamically?

    require_once( 'inc/header.inc.php' );
    require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
    require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
    // --------------- page variables and login
    $_page['name_index'] 	= forum;
    $_page['css_name']		= 'privacy.css';
    if ( !( $logged['admin'] = member_auth( 1, false ) ) )
    	if ( !( $logged['member'] = member_auth( 0, true ) ) )
    		if ( !( $logged['aff'] = member_auth( 2, false )) )
    			$logged['moderator'] = member_auth( 3, false );
    $_page['header'] = _t( "Forum" );
    $_page['header_text'] = _t( "Forum" );
    $after = $_GET["after"]; 
    $after = str_replace("nextvar", "&", $after);
    // --------------- page components
    $_ni = $_page['name_index'];
    $_page_cont[$_ni]['page_main_code'] = PageCompMainCode($after);
    // --------------- [END] page components
    // --------------- page components functions
     * page code function
    function PageCompMainCode($after)
    	global $oTemplConfig;
        $ret = "<iframe src='/forum/".$after."' scrolling='no' width='920px' height='1500px' frameborder='0'></iframe>";
        return DesignBoxContent( _t( "_PRIVACY_H1" ), $ret, $oTemplConfig -> PageCompThird_db_num);
  4. jobeard

    jobeard TS Ambassador Posts: 11,124   +982

    I've been out of town -- sorry for the delay in the reply.

    Your sample is dynamic PHP; learn on simple static pages to see how it all works
    and then move on to dynamic html.

    Yes, you can control the availability of scroll bars and content will flow (ie wrap)
    just like any other page

    frameset template:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN"
      <title>Some Title</title>
      <!-- stylesheet links and javascripts go here  -->
    <frameset rows="10%,90%">
       <frame name="banner" src="banner.html">
       <frameset cols="15%,*">
            <frame name="left"  src="nav.html">
            <frame name="right" src="index.content.shtml">
    <p> say something about needing a modern browser with Frame Support </p>
    Note that frame named right is has SSI content. Your *.phtml would work as well :)
  5. Julio Franco

    Julio Franco TechSpot Editor Posts: 7,667   +987

    It's not a good idea trying to merge two platforms using an HTML trick as you describe. Instead you should try coding, say a PHP-based CMS that interacts directly with the forum framework or the database itself. Of course, that's the ideal thing to do but also a LOT of work and learning.

    So I have an even better solution. Download the latest version of Storyteller (now called ContentTeller) which supports forum integration for phpBB:

    There is a free open-source version which you can use. Wordpress is also a superb blogging platform that can be extended for similar functionality using add-ons.
  6. Blind Dragon

    Blind Dragon TS Evangelist Topic Starter Posts: 3,908

    Thank you guys,

    I had played with contentteller and liked it a lot but I finally got what I was looking for.

    I installed both into the same database. Made a few changes to link the logins/logouts. Then had somebody help me with the md5 encryption that they both use on passwords so that it only gets encrypted once.

    Then as far as the page goes I decided to keep the iframe and use java script to determine the pages content height and pass it to the iframe. I found a script on this somewhere. Basically assigned the iframe and id and called the id in the javascript.

    Then as for SEO, I left the forum installed into a seperate folder which I added to my sitemap, then restricted forum.php using robots.txt so that google and other robots only crawl the forum folder
  7. jobeard

    jobeard TS Ambassador Posts: 11,124   +982

    For any who might follow this thread:

    Julio's comments are well taken and avoid the issue of "cross-domain scripting" which
    can be inhibited by browser security settings.

    The use of a CMS (Content Management System) and DBMS allows 'our site' to
    import content from various locations and then produce pages from the DBMS content,
    thus appearing to all browsers that it is 'local content'. The data flow looks like
                              webserver collector ------> various resources
                                  insert to dbms --->dbms
    browser  get xxx -----> webserver.cgi ----> dbms query
                                       <---     dbms results
                           <---- webserver reply
Topic Status:
Not open for further replies.

Similar Topics

Add your comment to this article

You need to be a member to leave a comment. Join thousands of tech enthusiasts and participate.
TechSpot Account You may also...