Jump to content

[SOLVED] 2 includes carrying layout but creates blankness


thefollower

Recommended Posts

Well if this url :

 

localhost/css/layout1.php

 

Loads... then what should the url be for the include?

 

Nope, thats what I have been saying... the html path to the file is different than the php path you have to define.

 

if your linking to the file in HTML then yes /css/layout1.php will be correct for all files no matter where they live. But in PHP a file in /folder1/folder2/file.php cannot use the same path as a file that lives in the root /file.php   

 

/file.php would find the include calling it the way you did, but /folder1/folder2/file.php will not find the path as it will start looking in /folder1/folder2/<begin looking here>

 

Nate

 

I concur

Link to comment
Share on other sites

in layout1.php put an echo statement in there and see if that echo statement shows through.

 

I have had problems using XAMPP / WAMP with the error reporting not functioning correctly and when I add the ini_set line at the top of the page I get all my errors.

 

you may not have error reporting set to a high enough level. if you have E_ERROR set, you will not get any notices, or warnings which can break the script depending on what the problem is.

 

So I would try the ini_set method.

 

 

Link to comment
Share on other sites

Whats the ini method?

 

Ok here is the code as it is now: (picture attached below also)

 

<?php
error_reporting(E_ALL);
include($_SERVER['DOCUMENT_ROOT'].'/css/layout1.php');
?>
<center>
<?php
Echo 'test';
  ?>
</center>
<p> </p>
<?php
include($_SERVER['DOCUMENT_ROOT'].'/css/layout2.php');
?>

 

 

 

I have attached a picture to show you where the two layouts are

 

 

[attachment deleted by admin]

Link to comment
Share on other sites

The ini_set method I referred to is this....

 

ini_set('error_reporting', E_ALL); 

 

I have had issues with this way..

 

error_reporting(E_ALL);

Try it like this....

<?php
  ini_set('error_reporting', E_ALL); 
  include($_SERVER['DOCUMENT_ROOT'].'/css/layout1.php');
?>
   Testing .... .this text should be seen

<?php  include($_SERVER['DOCUMENT_ROOT'].'/css/layout2.php');  ?>

 

and lemme know what you get.

Link to comment
Share on other sites

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.