Jump to content

Why is the frame not displaying when using "\n" tag


Go to solution Solved by eldan88,

Recommended Posts

Hey Guys. I am using php to output to frames. When I add an "\n" tag of even a PHP_EOL the second frame shows blank. The weird thing is when I view the page source I can clearly see the HTML of both frames... Can anyone help me resolve this issue? Thanks!

$iframe =  "<iframe src='menu_new.php' width='65%'  name='menu' id='menu' title='Menu Frame' ></iframe>\n"; //iframe not working when adding the /n on this line


$iframe .= "<iframe src='menu-items.php' width='35%' name='menu-items' id='menu-items' scrolling='yes' noresize='noresize'  title='Menu Items Frame'></iframe>\n";


    echo $iframe;

Not sure as I copy/pasted your code and it ran fine with the exception of not locating the menu_new.php and menu-items.php files (why does one use a underscore and the other a dash?).

 

Anything in the logs?

 

But... why even use php there? All you're doing is creating HTML and echoing it out. Why do you care about formatting the source code with \n?

The code works for me also (with and without the newline character). In case it matters, I even created a test page for both menu_new.php and menu-items.php. Did you try running the HTML code through a validator?

http://validator.w3.org/

 

Perhaps something else is going on...

No idea what's wrong.  It must be on your end.

 

Put a carriage return \r in there, maybe that'll fix it?

$iframe = "<iframe src='menu_new.php' width='65%' name='menu' id='menu' title='Menu Frame' ></iframe>\r\n";

Are you sure that this happens exclusively when you put the newline character?

  • Solution

Hey  cyberRobot and Zane. I realized it was a problem with the width on the left frame. I took down 1% and it shows on the right frame now. From some reason when I added the "/n" it didn't fit in the right frame, until I changed with wdith to 34% from 35%

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.