Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7994791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:13:11+00:00 2026-06-04T14:13:11+00:00

I have a problem with dividing site parts to different files so it’s easier

  • 0

I have a problem with dividing site parts to different files so it’s easier to edit, but I am having some problems.. the site doesn’t work..

This is the original part which works:

<?php if($_SERVER["HTTP_X_PJAX"]): ?>
<div id="main">first change</div>
<?php else: ?>
<html>
<head>
<script src="http://pjax.heroku.com/jquery.js"></script>
<script src="http://pjax.heroku.com/jquery.cookie.js"></script>
<script src="http://pjax.heroku.com/jquery.pjax.js"></script>
<script type="text/javascript">
$(function() { $('a').pjax('#main');
$('#main').bind('pjax:start', function(){$('#main').animate({ height: 'hide', opacity:                    'hide' }, 'fast')})
.bind('pjax:end', function(){$('#main').animate({ height: 'show', opacity: 'show' },   'slow')}); });
</script>
</head>
<body>
<?php
$header = "this is first part
<br/> <a href='test2.php' data-pjax='main'>GO</a>";
$date = date("Y-m-d H:i:s");
$footer = "this is first part";
echo "$header<br/>$date<br /><div id='main'>first page</div><br />$footer";
?>
</body>
</html>
<?php endif; ?>

This is what I have now, but it doesn’t work:

<?php $body = "<div id='main'>first page</div><br /><a href='pjax2.php' data-pjax='main'>GO BACK</a>"; ?>

<?php if($_SERVER["HTTP_X_PJAX"]): ?>
<?php echo "$body";?>
<?php else: ?><?php include "header.php";?>
<?php echo "$body"; ?><?php include "footer.php" ;>
<?php endif; ?>

Header.php is this:

<html>
<head>
<script src="http://pjax.heroku.com/jquery.js"></script>
<script src="http://pjax.heroku.com/jquery.cookie.js"></script>
<script src="http://pjax.heroku.com/jquery.pjax.js"></script>
<script type="text/javascript">
$(function() { $('a').pjax('#main');
$('#main').bind('pjax:start', function(){$('#main').animate({ height: 'hide', opacity:     'hide' }, 'fast')})
.bind('pjax:end', function(){$('#main').animate({ height: 'show', opacity: 'show' },     'slow')}); });
</script>
</head>
<body>

Footer.php is this:

</body></html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T14:13:13+00:00Added an answer on June 4, 2026 at 2:13 pm

    Try to replace your code by :
    – Remove unused php’s tags
    – Be sure that header.php and footer.php are in the same directory that your current file.

    <?php 
    $body = "<div id='main'>first page</div><br /><a href='pjax2.php' data-pjax='main'>GO BACK</a>"; 
    
    if($_SERVER["HTTP_X_PJAX"]) {
        echo $body;
    } else {
        include("header.php");
        echo $body; 
        include("footer.php");
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some weeks since im using CI, but now I've found some problems
I have been having some problems with the test debugger in VS10. All tests
I have problem with passing variables through views. But, first some code // i
I have problem SIMILAR to preventing form data reposting, but not quite the same
I have problem developing with live555. I already build the lib-files and example projects
I having trouble in dividing the HTML frames. I have been using the following
I have a problem with dividing a multicolumn layout in HTML. I have divided
While dividing my C# application in layers, I have solved the problem of circular
I have a problem with dividing a long value by 1000 and round it
I have some problems with figures in Matlab. I divided my bar plot into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.