frames in php ??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
daan
Forum Commoner
Posts: 25
Joined: Wed Nov 16, 2005 10:32 am

frames in php ??

Post 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
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post 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>';
?>
daan
Forum Commoner
Posts: 25
Joined: Wed Nov 16, 2005 10:32 am

Post by daan »

thanx, the error is gone,
but he does not seem to find the $a1[website]
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

Post by pleigh »

have you tried removing the apostrtophes in $a1['website'] ?
daan
Forum Commoner
Posts: 25
Joined: Wed Nov 16, 2005 10:32 am

Post 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?
Post Reply