Sign Up for OSTraining

Welcome, Guest
Username: Password: Remember me

TOPIC: Unable to fix syntax error

Unable to fix syntax error 11 months 2 weeks ago #47870

Hi,

I just typed out a long, descriptive question/explanation and your server crashed or something (2 times) and I found myself on a 404 not found page.

Dreamweaver is showing me a syntax error on line 102. However, being that I don't know PHP I thought that perhaps the error was in the code and not at the </footer> tag. But I can't figure it out. Any help is appreciated.

Here is the code because I also seem unable to attach the index.php file:

<?php
defined('_JEXEC') or die;

/* check for left/right sidebars (3 cols each) and adjust article width */
$article_width = "grid_12";
if($this->countModules('left and right')) {
/*both left and right columns present */
$article_width = "grid_6";
}
else {
if($this->countModules('left or right')) {
/*only one sidebar */
$article_width = "grid_9";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >

<head>
<jdoc:include type="head" />
<link rel="stylesheet" href="<?php echo $this->baseurl; ?>/templates/system/css/system.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl; ?>/templates/system/css/general.css" type="text/css" />

<link rel="stylesheet" href="templates/<?php echo $this->template ?>/css/template.css" type ="text/css"/>

</head>
<body>

<div id="container" class="container_12">

<div id="header" class="grid_12">
<jdoc:include type="modules" name="header" style="xhtml" />
<div id="topmenu">
<jdoc:include type="modules" name="topmenu" style="xhtml" />
</div> <!-- top menu -->
</div><!-- header -->


<?php if ($this->countModules('top1')) { ?>
<div id="top-wrapper" class="grid_12">
<div id="top1-wrapper" class ="grid_4">
<div id="top1">
<jdoc:include type="modules" name="top1" style="xhtml" />
</div> <!-- top1 -->
</div> <!-- top1-wrapper -->

<div id="top2-wrapper" class ="grid_4">
<div id="top2">
<jdoc:include type="modules" name="top2" style="xhtml" />
</div> <!-- top2 -->
</div> <!-- top2-wrapper -->

<div id="top3-wrapper" class ="grid_4">
<div id="top3">
<jdoc:include type="modules" name="top3" style="xhtml" />
</div> <!-- top3 -->
</div> <!-- top3-wrapper -->

</div> <!-- top wrapper -->
<?php }; ?>


<div id="content-wrapper" class ="grid_12">

<?php if ($this->countModules('left')) { ?>
<div id="left-wrapper" class="grid_3">
<div id="left">
<jdoc:include type="modules" name="left" style="xhtml" />
</div> <!-- left -->
</div> <!-- left wrapper -->
<?php }; ?>


<div id="article-wrapper" class="<?php echo $article_width ?>">
<div id="article">
<!-- articles are handled differently than modules so don't include: <jdoc:include type="modules" name="topmenu" style="xhtml" /> -->
<jdoc:include type="component" />
<jdoc:include type="message" />

</div> <!-- article -->
</div> <!-- article-wrapper -->


<? if ($this->countModules('right')) { ?>
<div id="right-wrapper" class="grid_3">
<div id="right">
<jdoc:include type="modules" name="right" style="xhtml" />
</div> <!-- right -->
</div> <!-- right wrapper -->
<?php {; ?>

</div> <!-- content wrapper -->
<div class="clear"></div>

<div id="footer" class="grid_12">
<?php if ($this->countModules('footer')) { ?>
<jdoc:include type="modules" name="footer" style="xhtml" />
<?php } else { ?>
<p>no footer module published</p>
<?php }; ?>
</div> <!-- footer -->

</div> <!-- container -->

</body>
</html>

Thanks,
Eric
Please become a member of OSTraining to reply to this post.

Unable to fix syntax error 11 months 2 weeks ago #47873

  • Nick
  • Nick's Avatar
  • OFFLINE
  • Administrator
  • Posts: 16726
  • Thank you received: 371
  • Karma: 54
Hi WriterDesigner,

Yes, you are unable to attach php files for security reasons. they must be zipped if you want to attach them.

What Joomla version are you using? What's the exact error message you're getting? Can we get a link to the page to see the error message?

Kind regards,
Nick
Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining
Please become a member of OSTraining to reply to this post.

Unable to fix syntax error 11 months 2 weeks ago #47874

  • tessa
  • tessa's Avatar
  • NOW ONLINE
  • Moderator
  • Posts: 3946
  • Thank you received: 134
  • Karma: 9
Hi Eric,

I just read through your php code. You are missing a semi colon after the $article_width variable before closing the php ?>
(in the div Id article-wrapper)
I can't copy and paste to show the entire line of code... On my iPhone. :-D
Warm Regards,

Tessa Mero



Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining
Please become a member of OSTraining to reply to this post.

Unable to fix syntax error 11 months 2 weeks ago #47876

Nick, Dreamweaver is simply highlighting the line 102 with red (which would mean there is an error, either there or before that line of code).

Tessa, I have the tutorial video "Collapsible Module Positions Part 2" pulled up and I can't find a semi-colon anywhere in the video -- or during the part where she's talking about the article-wrapper id. Do I include the ; in it's own <?php ; ?> like that or just by itself? Sorry, but I can't visualize what you're suggesting I do.

Thanks,
Eric
Please become a member of OSTraining to reply to this post.

Unable to fix syntax error 11 months 2 weeks ago #47877

  • tessa
  • tessa's Avatar
  • NOW ONLINE
  • Moderator
  • Posts: 3946
  • Thank you received: 134
  • Karma: 9
<?php echo $article_width; ?>

This will fix your syntax error.
Warm Regards,

Tessa Mero



Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining
Please become a member of OSTraining to reply to this post.

Unable to fix syntax error 11 months 2 weeks ago #47878

  • tessa
  • tessa's Avatar
  • NOW ONLINE
  • Moderator
  • Posts: 3946
  • Thank you received: 134
  • Karma: 9
Without adding this semi colon to end a php statement, the code u have will not work. Refer to the above post from this post. :-)
Warm Regards,

Tessa Mero



Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining
Please become a member of OSTraining to reply to this post.

Unable to fix syntax error 11 months 2 weeks ago #47879

Hello Tessa,

I added the ; but my webpage is still blank. I am uploading a screenshot of what my file looks like in Dreamweaver and of the index webpage. I'd like but webpage to this reply, but it's hosted locally on my computer with MAMP.
Please become a member of OSTraining to reply to this post.

Unable to fix syntax error 11 months 2 weeks ago #47880

  • tessa
  • tessa's Avatar
  • NOW ONLINE
  • Moderator
  • Posts: 3946
  • Thank you received: 134
  • Karma: 9
Try adding a closing div or removing a closing div. you should have as many closing divs as you have opened, and if I counted correctly they dont match.
Warm Regards,

Tessa Mero



Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining
Please become a member of OSTraining to reply to this post.

Unable to fix syntax error 11 months 2 weeks ago #47881

  • Nick
  • Nick's Avatar
  • OFFLINE
  • Administrator
  • Posts: 16726
  • Thank you received: 371
  • Karma: 54
Hi WriterDesigner,

Please try turning error reporting to "Maximum" within your global configuration's server tab.

Kind regards,
Nick
Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining
Please become a member of OSTraining to reply to this post.

Unable to fix syntax error 11 months 2 weeks ago #47882

Tessa, I am combing the code for a missing <div> or </div> tag, and if I do/don't find one I'll report my findings (searched once but didn't find one).

Thanks for the heads up.
Please become a member of OSTraining to reply to this post.

Unable to fix syntax error 11 months 2 weeks ago #47883

  • edandrea
  • edandrea's Avatar
  • OFFLINE
  • OSTop Dog
  • Posts: 3106
  • Thank you received: 7
  • Karma: 0
One thing I can see right away is that you don't need php tags around else. That statement starts at If and you don't need to end it until you're done with the else tag.

Another thing you should check for is extra characters, lines or spaces at the beginning of the file, which we can't see in the screenshot. If you save this same file with a .txt extension you will be able to attach it. Maybe we can get a better look that way.

Cheers,
Ed
Please become a member of OSTraining to reply to this post.

Unable to fix syntax error 11 months 2 weeks ago #47885

Ed,

I went ahead and removed the php tags around the else in the footer.
So that it now looks like this:
<div id="footer" class="grid_12">
<?php if ($this->countModules('footer')) { ?>
<jdoc:include type="modules" name="footer" style="xhtml" />
else
<p>no footer module published</p>
<?php }; ?>
</div> <!-- footer -->

The file will not attach as a .txt file (and I did open TextEdit, save the code there, and save it as a .txt to my desktop). I keep getting a 404 error message.

I am wondering if for some bizarre reason the CSS files are not linking, because by using firebug it doesn't recognize any CSS. I briefly had this problem when I started the tutorials for the template. However, going into the MAMP > htdocs > template files, and then navigating to the template1_trial folder, and from there going to the CSS folder, all of the CSS files are there. The index.php links to them, and only until I watched this tutorial video (and added the code) did I have this problem. Otherwise for the most part the tutorials have been going smoothly.

Thank you,

Eric
Please become a member of OSTraining to reply to this post.

Unable to fix syntax error 11 months 2 weeks ago #47886

  • Nick
  • Nick's Avatar
  • OFFLINE
  • Administrator
  • Posts: 16726
  • Thank you received: 371
  • Karma: 54
Hi Eric,

Did you try turning error reporting to "Maximum" within your global configuration's server tab?

Kind regards,
Nick
Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining
Please become a member of OSTraining to reply to this post.

Unable to fix syntax error 11 months 2 weeks ago #47887

Hello Nick,

I honestly don't know what the global configuration server tab is.

I'm going to try restarting the MAMP local server to see if that has something to do with it. Tessa had suggested finding <div>'s that didn't match but so far everything checked out okay.
Please become a member of OSTraining to reply to this post.

Unable to fix syntax error 11 months 2 weeks ago #47889

  • Nick
  • Nick's Avatar
  • OFFLINE
  • Administrator
  • Posts: 16726
  • Thank you received: 371
  • Karma: 54
Hi Eric,

If you're using Joomla 2.5, go to your admin area >> Site (top menu) >> Global Configuration (drop down) >> Server (tab) >> Error reporting >> set it to Maximum >> save.

Check the front-end. Hopefully you'll get a detailed error message rather than a blank page. Copy any error message that you get in here.

Hope this helps!

Kind regards,
Nick
Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining
Please become a member of OSTraining to reply to this post.

Unable to fix syntax error 11 months 2 weeks ago #47890

Thanks Nick,

Here is the message I am getting:

Parse error: syntax error, unexpected $end in /Applications/MAMP/htdocs/design/templates/template1_trial/index.php on line 109
Please become a member of OSTraining to reply to this post.

Unable to fix syntax error 11 months 2 weeks ago #47891

  • edandrea
  • edandrea's Avatar
  • OFFLINE
  • OSTop Dog
  • Posts: 3106
  • Thank you received: 7
  • Karma: 0
HI Eric,

It might also help to go back a step and get the index.php version that was working last, then show us what you are trying to add. We may be able to help you through that step.

My suggestion here ia s slower, step by step approach so we can see where the problem comes up first. Much easier than trying to analyze something already written, especially since we don't have access to it.

At least that's what I would do.

Cheers,
Ed
Please become a member of OSTraining to reply to this post.

Unable to fix syntax error 11 months 2 weeks ago #47933

  • tessa
  • tessa's Avatar
  • NOW ONLINE
  • Moderator
  • Posts: 3946
  • Thank you received: 134
  • Karma: 9
Hi WriterDesigner,

Is there a way you can host this onto a live site? It would be much easier to debug and find the cause of the error. :-)

Also if you think it's part of that code that is causing the issue, sometimes it's best to break it up piece by piece to see what works and when it stops working. :-)
Warm Regards,

Tessa Mero



Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining
Please become a member of OSTraining to reply to this post.

Unable to fix syntax error 11 months 2 weeks ago #47951

Hello, I apologize for not replying sooner, as I was locked out of your website, but the issue now seems to be resolved (as I can access it now on my iPad).

I'll see about putting it on a live host tomorrow.

Thank you for your suggestions.

Regards,

Eric
Please become a member of OSTraining to reply to this post.

Unable to fix syntax error 11 months 2 weeks ago #47968

  • Nick
  • Nick's Avatar
  • OFFLINE
  • Administrator
  • Posts: 16726
  • Thank you received: 371
  • Karma: 54
Hi Eric,

You're welcome! We're glad to be of help and even more glad that you got things sorted! :)

Kind regards,
Nick
Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining
Please become a member of OSTraining to reply to this post.

Unable to fix syntax error 11 months 2 weeks ago #48091

  • Nick
  • Nick's Avatar
  • OFFLINE
  • Administrator
  • Posts: 16726
  • Thank you received: 371
  • Karma: 54
Hi Eric,

Would you open up a new forum topic for this new issue, please? Thanks in advance!

Kind regards,
Nick
Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining
Please become a member of OSTraining to reply to this post.

Sign Up for OSTraining

Powered by Kunena Forum

Open Source Training is not affiliated with or endorsed by the Joomla, WordPress or Drupal projects.
All product names and trademarks are the property of their respective owners.

Copyright 2013 Open Source Training, LLC. All rights reserved.