Page 1 of 1
frames in php ??
Posted: Sat Mar 04, 2006 10:24 am
by daan
what i would like to do is to open a website (url is stored in database under $a1[website]) in a frame, with a banner in the head frame. I tried this:
Code: Select all
<?
require_once("conn.php");
require_once("includes.php");
$ShowInfo .= "<FRAMESET BORDER=0 FRAMESPACING=0 FRAMEBORDER=0 ROWS="74,*">
<FRAME NAME="header" TITLE="header" SRC="header.html" SCROLLING=AUTO MARGINWIDTH="2" MARGINHEIGHT="1" FRAMEBORDER=NO BORDER="0" NORESIZE>
<FRAME NAME="body" TITLE="body" SRC="$a1[website]" SCROLLING=AUTO MARGINWIDTH=2 MARGINHEIGHT=2>
</FRAMESET>";
?>
i get following error:
Parse error: parse error, unexpected T_LNUMBER in /home/website.php on line 5
could anyone help me? thanx
Posted: Sat Mar 04, 2006 10:36 am
by nickvd
First things first, these forums have a [ php ] tag which will use syntax highlighting to make it easier to read code...
secondly, the error is due to you using double quotes to open then string, but you also use double quotes around your attribute tags
Code: Select all
<?php
require_once("conn.php");
require_once("includes.php");
$ShowInfo .= "<FRAMESET BORDER=0 FRAMESPACING=0 FRAMEBORDER=0 ROWS="74,*">
<FRAME NAME="header" TITLE="header" SRC="header.html" SCROLLING=AUTO MARGINWIDTH="2" MARGINHEIGHT="1" FRAMEBORDER=NO BORDER="0" NORESIZE>
<FRAME NAME="body" TITLE="body" SRC="$a1[website]" SCROLLING=AUTO MARGINWIDTH=2 MARGINHEIGHT=2>
</FRAMESET>";
?>
either escape the double quotes (") in your html code (such as <FRAME NAME=\"header\" TITLE=\"header\" [...])
or, use single quotes for the string:
Code: Select all
<?php
require_once("conn.php");
require_once("includes.php");
$ShowInfo .= '<FRAMESET BORDER=0 FRAMESPACING=0 FRAMEBORDER=0 ROWS="74,*">
<FRAME NAME="header" TITLE="header" SRC="header.html" SCROLLING=AUTO MARGINWIDTH="2" MARGINHEIGHT="1" FRAMEBORDER=NO BORDER="0" NORESIZE>
<FRAME NAME="body" TITLE="body" SRC="'.$a1['website'].'" SCROLLING=AUTO MARGINWIDTH=2 MARGINHEIGHT=2>
</FRAMESET>';
?>
Posted: Sat Mar 04, 2006 1:39 pm
by daan
thanx, the error is gone,
but he does not seem to find the $a1[website]
Posted: Sun Mar 05, 2006 10:40 am
by pleigh
have you tried removing the apostrtophes in $a1['website'] ?
Posted: Sun Mar 05, 2006 11:33 am
by daan
no does not work, he does not show the website, i think because he does not know the user to take it from.
now it is like this:
each listing has the following: info.php?userid
and in there, there is a link to an external url like this:
Code: Select all
<b><a class=BlueLink href=\"$a1[website]/">
$a1[website]</a>
here he knows the user id and he opens the right website
cant i just implement a frame from here?