Give help. Get help.

  • # August 7, 2009 at 8:52 am

    I tried the solution on this for a site I am working on. Here is a scenario :

    • I want to have a login page for my site which is based on wordpress. Users are not suppose to see anything on the site unless they are logged on. So,[/*:m]
    • I put all the code inside my header file and inside the IF condition I have put the form just like in your demo. All users must be logged on to see the site. See snippet below…[/*:m]
    • My ELSE part will be my entire page. The contents of the header file – menus and the whatnot, everything inside the wrapper and footer. I close the ELSE brace at the end of the footer[/*:m][/list:u].
      Problem: I am getting an error when I close the brace for the ELSE part of the IF statement.

      Here is a small snippet:

      if (condition){
      ///form goes here
      }else {
      //rest of the header file
      //wrapper opens here and closes at the end of the index file
      } // this is done at the end of the footer. But i get an error.

      What am I missing?

    # August 7, 2009 at 9:51 am

    What is the error that you are getting? The code snippet itself looks ok.

    # August 7, 2009 at 10:21 am


    Thanks for your response.

    I get the error when closing the brace for the ELSE part of the IF statement:

    [Fri Aug 07 13:56:50 2009] [error] [client] PHP Parse error: parse error in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\…\header.php on line 77, referer: http://localhost/test/.

    I tried the following:
    I closed the ELSE statement at the start of footer.php – the error then I tried at the end of the index file just before <?php get_footer();?>. And I get the error again.

    Now, just so that I can test what I am doing I closed the brace just before the wrapper <div> – this is inside the header file.

    just out of curiosity – am not a php or wordpress guru – is it possible to close code block – {//code block} in a different file?

    # August 7, 2009 at 10:52 am

    Yes, it is possible to close the code block in a different file. Are you sure you don’t have an extra closing } in one of your files? That may cause the error, which means that what you think is the closing } on the if statement is actually unnecessary.

    # August 7, 2009 at 11:18 am

    I guess that is my project for the weekend…. Going through the function calls in wordpress…

    Thanks gain.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.