473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

page loads but only header is displayed and rest of the content is blank

107 100+
i have the following code which is generated from a .dwt template. My problem is that the page loads but only the header part displays and rest of the contents are not displayed. Everything works fine in my local testing server but when i upload it the hosting server the problem surfaces. I am not sure why? Please kindly go through my code below:

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <!-- InstanceBegin template="/Templates/generaltemplate.dwt.php" codeOutsideHTMLIsLocked="false" -->
  4. <head>
  5. <!-- InstanceBeginEditable name="doctitle" -->
  6. <title>Title of my site</title>
  7. <!-- InstanceEndEditable -->
  8. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  9. <!-- InstanceBeginEditable name="head" -->
  10. <!-- InstanceEndEditable -->
  11. <link href="css/global.css" rel="stylesheet" type="text/css" />
  12. </head>
  13. <?php
  14. include("include/header.inc");
  15. include("include/session.php");
  16. ?>
  17. <body>
  18. <div id="nav">
  19.   <div id="navigation"> 
  20.     <a href="1.php">Link1</a> <span id="arrow">||</span> 
  21.    <a href="2.php">Link2</a><span id="arrow"> || </span>
  22.    continues…………    
  23.   </div>
  24.  <br>
  25. </div>    
  26. <table width="100%" cellpadding="0" cellspacing="0" border="0">
  27.  <tr>
  28.    <td width="17%" valign="top">
  29.      <table class="tbl" cellspacing="0" cellpadding="0" border="0">
  30.              <tr class="mnutitle">
  31.                <td style="padding-left: 12px" colspan="3">MENU</td>
  32.              </tr>
  33.              <tr>
  34.                <td style="width: 12px"></td>
  35.                <td width="151" class="menu">
  36.                  <a title="Home Page" href="home.php">Home</a></td>
  37.                <td style="width: 9px"></td>
  38.              </tr>
  39.              <tr>
  40.                <td></td>
  41.                <td class="menu">
  42.                  <a title="Menu1" href="menu1.php">Menu1</a></td>
  43.                <td></td>
  44.              </tr>
  45.              <tr>
  46.                <td></td>
  47.                <td class="menu">
  48.                  <a title="Menu2" href="menu2.php">Menu2</a></td>
  49.                <td></td>
  50.     </tr>
  51.            continues.............
  52.          </table>
  53.            <br>
  54.             <br>
  55.             <table>
  56.                 </td>
  57.    <td width="83%" valign="top" class="contents">
  58.      <!-- InstanceBeginEditable name="content" -->
  59.     ( My PHP lines) ……
  60.      <!-- InstanceEndEditable -->      
  61.    </td>
  62.   </tr>
  63. </table>
  64. <br>
  65. <br>
  66. <?php
  67. include("include/footer.inc");
  68. ?>
  69. </body>
  70. <!-- InstanceEnd -->
  71. </html>
  72.  
  73.  
Here please note that if i remove the
include("include/session.php");
part it works but since the session file is required in every pages i cannot avoid it. I find nothing wrong in session file with makes the script to suspend from executing. Please advice me.
Sep 16 '09 #1
13 2940
Dormilich
8,658 Expert Mod 8TB
sessions have to be initialized, before any output is sent to the browser.
Sep 16 '09 #2
raamay
107 100+
@Dormilich
Yes you are right and the session has already been initialized in the session class itself . I include the session class and then declare global variable $session in every page before using the class. Thus, i feel there should not be any problem.
Sep 16 '09 #3
Dormilich
8,658 Expert Mod 8TB
in the code you have given, the session code is on line 15, where 12 lines of HTML output have been already sent.
Sep 16 '09 #4
raamay
107 100+
@Dormilich
ok i get you, and it would be wise to use include("include/session.php"); on top of the page instead of placing in between. I did that but it doesnt solve the problem. when i do that the whole page becomes empty (the header is also gone).
Sep 16 '09 #5
Dormilich
8,658 Expert Mod 8TB
that looks like an error in the session.php file.
Sep 16 '09 #6
raamay
107 100+
@Dormilich
But why php do not show an error? At times the static contents gets displayed while the dynamic ones are lost. This is quite disgusting. i cant figure out what the problem is.
Sep 16 '09 #7
Dormilich
8,658 Expert Mod 8TB
@raamay
without any code I can’t either.
Sep 16 '09 #8
TheServant
1,168 Expert 1GB
You CANNOT start sessions if any output has been done. If you can't move your <?php include('include/session.php'); ?> to the top of the document, then remove your session start from session.php and put it at the top. Like:

Expand|Select|Wrap|Line Numbers
  1. <?php session_start(); ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 ... 
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
  4. <!-- InstanceBeginEditable name="head" --> 
  5. <!-- InstanceEndEditable --> 
  6. <link href="css/global.css" rel="stylesheet" type="text/css" /> 
  7. </head> 
  8. <?php 
  9. include("include/header.inc"); 
  10. include("include/session.php"); 
  11. ?> 
  12. <body> 
  13.  
Also, if you are getting errors, please include those in your post. Most errors are descriptive enough, but those which are not, have usually been experienced before and the Bytes team may be able to recognise them and thus provide solutions to that exact problem. It's simpler to read errors that a page of code ;)
Sep 16 '09 #9
raamay
107 100+
sorry to bother you again, as said earlier if i include the session file it does not work. well i will have used the same session file that is found here. The session file aswell as other file here works fine cause previously my site had the same files used. recently i got rid of my old files and replaced it will new updates, then there surfaced the problem.
Sep 17 '09 #10
raamay
107 100+
i understand that php should obviously show errors if there is any. But let me tell you one thing that even if i write something rubbish inside the file (session file) it wont display any errors. I am very surprised and pissed off. what i found was that the session file included in my pages do not get read or executed. i tried echoing some line in the session file right after session_start() but nothing gets printed. Whereas in my local server it works as it ought to be. So, i am not sure where the problem lies.
Sep 17 '09 #11
TheServant
1,168 Expert 1GB
So in your master document, which is what calls session.php, the command session_start() is called before any HTML? Just trying to confirm that your original code has been corrected.

Have you tried renaming your session.php and seeing if that works? If not, then either your path is wrong, there is no output of that file, or your PHP needs to be re-installed because include is broken (more of a joke - this is very unlikely).

Do other includes work?

Can you make a post with your main file UPTO calling session.php, as well as session.php.
Sep 17 '09 #12
raamay
107 100+
thankyou very very much dormilich and servant for your help and support. At last i could manage it myself. The web server had disabled error reporting, so i added
Expand|Select|Wrap|Line Numbers
  1. error_reporting(E_ALL); ini_set('display_errors','On'); 
in one of the page and it worked. Now i can see errors in my files, if any. thankyou all again.
Sep 17 '09 #13
TheServant
1,168 Expert 1GB
LOL, I should have thought of that. Glad it's working.
Sep 17 '09 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Matt | last post by:
I was wondering if someone could explain why I'm receiving this error. It's like a 404 error but I think it might be something else. Basically, I have a page where a user inputs his email...
1
by: Francois Gagnon | last post by:
Hi, I have the following scenario. THe side is built using 2 frames. The top frame is a menu where the bottom one is the content. The top frame allows th user to select what document he wants...
6
by: Mitch | last post by:
I'm trying to use page inheritance so that I can derive all web pages from a template. There are a bunch of examples at this site http://authors.aspalliance.com/PaulWilson/Articles/?id=1, but...
4
by: Adrijan Josic | last post by:
I have this idea, I need to know if it is possible and how. Let's say you have a content managed site with all its structure and content - everything in a relational database And a "blank" page...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
11
by: frizzle | last post by:
Hi there, I need a function to prevent a page from being loaded too often too fast. So say, one is only allowed to refresh a single page 5 times in 10 seconds, or 10 times in 5 seconds (or...
11
by: ra294 | last post by:
I am building a page that needs to recieve some parametes and return blank page (empty response). After I recieve the parametes I write: Response.clear Response.End When I run the page I still...
6
by: lokeanwolf | last post by:
Hi. I'm trying to create a basic template for a page, so that I can have the headers and footers stay the same, and only change the center content. I've already figured out how to do the includes...
0
by: bergenpeak | last post by:
I've got loads of existing web pages (vanilla html, html + frames, etc) and 100s of non html files (just raw text). I'd like to wrap these pages with the classic navigation format and info. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.