Recent Topics

1 Aug 07, 2006 20:50    

This is not so much a b2evolution question, as a general XHTML, coding question.

Is there any way to embed a web page into another web page? I am trying to include a search form from one page in another, without having to do all the coding, programming, etc. I do have permission from the original site owner, I just don't know how to do this. Ideally, the "copied" page would sit inside the "host" page and both would retain their look and feel.

Thanks so much in advance. I greatly appreciate it.

2 Aug 08, 2006 14:59

Should be in the chat away forum...

Anyway, the typical way is to use something like the following code (it's just a extract to give you the idea)


// The first item in this array will be the default page
$pages = array(
  array(
     'code' => 'blog',
     'title' => 'Welcome to my blog',
     'file' => 'pages/_blog.page.php'
  ),
  array(
    'code' => 'gallery',
    'title' => 'My Gallery',
    'file' => 'pages/_gallery.page.php' )
);
$pages_size = sizeof($pages);


if( isset($_GET['page']) )
{ // will not check to see if the page is a valid page
  $page = $_GET['page'];
  $found_page = false;
  for ( $i = 0; $i < $pages_size; $i++ )
  { // scan the pages and see if it exists
     $current_page = & $pages[$i];
     if( $page == $current_page )
     { // we have a match!
        $page = $current_page;
        $found_page = true;
        break; // stop the for loop
     }
  }
  if ( ! $found_page )
  { // we didn't find the page the user is looking for!
     $page = $pages[0]; // or optionally a page not found page
  }
} else
  $page = $pages[0];


include($page['file']);

Should be enough to get you started, be sure to have a fiddle with it and expirement :D

The PHP manual is brilliant, and be sure to give it a read when you need to know something.

3 Aug 08, 2006 16:12

balupton wrote:

Should be in the chat away forum...

Agreed and therefore moved. As a general rule if it's not a question specific to b2evolution it probably belongs in the chat forum.

4 Aug 09, 2006 14:18

Sorry for the wrong location, and thanks for the help!


Form is loading...