Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Senior Member
    Join Date
    Apr 2005
    Location
    Hatfield, England
    Posts
    855
    Member #
    9790
    I am trying to tidy up my code and put as much as i can in external files. I have created a file called loginlogout.php. It contains a function with the same name.

    Because the function contains the check to see if the user is logged on I figured i could have the following.

    PHP Code:
    <div class="logininbox">
        <?php
            
    function loginlogout()
        
    ?>
    </div>
    This came up with the following error.
    Parse error: parse error, unexpected ';', expecting '{' in /homepages/30/d148891800/htdocs/UNC/main.php on line 36
    Could someone tell me what i doing wrong?

    ===================

    As a secondary question. The PHP generates some html code based on whether the user is logged in or out. Does this mean that i can style the code under my div log-in class? Or would the CSS not pick that up?

  2.  

  3. #2
    ljm
    ljm is offline
    Senior Member ljm's Avatar
    Join Date
    Aug 2006
    Location
    Manchester, England
    Posts
    284
    Member #
    13684
    Liked
    1 times
    The CSS would pick it up as the script is outputting HTML.

    To answer the first question, if you're calling your own function, you do it like any other:

    PHP Code:
    <?php loginlogout(); ?>
    Any arguments go inside the parentheses, like with any function.

    You only need to use [minicode]function loginlogout()...[/minicode] when you're creating a new one. The error message is saying that you've no curly brackets that contains the code for your function.

    Also you need to make sure you include the external file that contains your function.

  4. #3
    Senior Member
    Join Date
    Apr 2005
    Location
    Hatfield, England
    Posts
    855
    Member #
    9790
    Thanks a lot for the help


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:03 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com