For almost two weeks, I've been going crazy trying to move a site I was building locally to Host Gator. Everything works perfectly fine locally but when I transfer it, everything crashes. One of the errors I get is this:
Parse error: syntax error, unexpected $end in xxx/page--front.tpl.php on line 1
That error seems to be coming from this snippet since the page will render if I just comment out the line specified below.
I am also noticing that the if statement isn't executing at all. I have the echo statements there to see if it's jumping into the if or else statements and none of them are executed.
<?php
global $user;
$userName = $user->name; // if this line is commented out, the page will render
$userID = $user->uid;
if (user_is_logged_in()) {
echo "logged in";
//user is logged in
print t("<li class='dropdown'> <a href='#' class='dropdown-toggle' data-toggle='dropdown'> <i class='icon-user icon-white'></i> {$userName} <b class='caret'></b></a>
<ul class='dropdown-menu'>
<li><a href='user'>Account</a></li>
<li><a href='user/{$userID}/edit'>Settings</a></li>
<li class='divider'></li>
<li><a href='user/logout'>Log Out</a></li>
</ul>
</li>");
} else {
echo "not logged in";
//user is not logged in
print t("<li><a href='#account' data-toggle='modal'>Sign In</a></li>");
}
?>Another problem I am having is that not everything is displaying. After I comment the line out above and the page renders, the main-menu doesn't show up. I know it's connecting to the database because I have the "Most Recent Posts" set up in a block of the footer and it's showing all the links to the corresponding nodes. The links will go to the nodes but then none of the pictures will show up. The blog posts and comments all show up fine though.
This is the code thats suppose to output the main-menu but doesn't seem to be doing anything now:
<?php
print theme('links__system_main_menu', array('links' => $main_menu, 'attributes' => array('class' => array('nav'))));
?>So after the page renders, I get this error:
Notice: Use of undefined constant php - assumed 'php' in include() (line 1 of xxx/page--front.tpl.php)
I've gone through the entire code and I don't see any stray php tags anywhere so I don't know what could be causing that error.
Can somebody please help me! I will be forever grateful =)
Comments
Assuming that package is
Assuming that package is transfer successfully and server meets package requirements.
Do :
- Clear all cache tables
- Disable the css,js compression
- go to themes page
- select the theme again and save the configuration
In some of the scenario generally database dumps are imported with the un-empty cached tables and that causes the issues.
-
Ujval Shah
Drupal Consultant
Ok I tried those steps but
Ok I tried those steps but I'm still having the same problems. I still don't understand why the if statement isn't being executed. Any other suggestions?
After playing around with it
After playing around with it a little more. I was able to get the main menu to show again using drupal's default code rather than zen's code
<?phpif ($main_menu):
?>
<?phpprint theme('links__system_main_menu',
array('links' => $main_menu,
'attributes' => array(
'id' => 'main-menu-links',
'class' => array('nav'))));
?>
<?phpendif;
?>
I also got the if statement to work but have no idea how. After getting the main menu to show up, I cycled through all the links to make sure they were all working and noticed that the if statement was working on one of the pages. So I just copied and pasted that into the others. I'm assuming I was missing a semicolon or something somewhere.