+ Reply to Thread
Results 1 to 3 of 3

Thread: PHP If variable is set to

  1. #1
    amr1991's Avatar
    amr1991 is offline x10 Sophmore amr1991 is an unknown quantity at this point
    Join Date
    Jul 2006
    Posts
    198

    PHP If variable is set to

    I am creating my own CMS. I am trying to implement a navigation system that automatically checks if a page is active, meaning that the page is availible to users. To define whether the page is availible, a variable is placed in a file called config.php.

    For example,
    PHP Code:
    $news 1;
    $downloads 0;
    $forum 1;
    $gallery 1
    if the variable is set to 1, its active, otherwise, its inactive. I want PHP to count how many of those variables are active, then use it in a FOR loop to echo the active variables. Any help would be appreciated.
    Last edited by Chris Z; 05-10-2007 at 08:16 PM. Reason: added the PHP coding feature





  2. #2
    Brandon's Avatar
    Brandon is offline Former Senior Account Rep Brandon is on a distinguished road
    Join Date
    Jun 2006
    Location
    Tewksbury, MA
    Posts
    9,589

    Re: PHP If variable is set to

    The only way I can think of this is with an array, using count() then foreach().
    Thanks,
    Brandon Long

  3. #3
    amr1991's Avatar
    amr1991 is offline x10 Sophmore amr1991 is an unknown quantity at this point
    Join Date
    Jul 2006
    Posts
    198

    Re: PHP If variable is set to

    the count function with an array worked fine, thanks for the help!





+ Reply to Thread

Similar Threads

  1. [PHP] Variables in PHP
    By Bryon in forum Tutorials
    Replies: 15
    Last Post: 01-29-2009, 09:46 AM
  2. tons of PHP Resources
    By Chris S in forum Scripts & 3rd Party Apps
    Replies: 10
    Last Post: 01-16-2009, 10:07 AM
  3. [PHP] PHP For Starters
    By Complex in forum Tutorials
    Replies: 24
    Last Post: 06-14-2008, 11:40 PM
  4. Unstand PHP?
    By o0slowpaul0o in forum Tutorials
    Replies: 8
    Last Post: 01-07-2008, 09:16 PM
  5. "PHP Startup: Invalid Library" - Interesting error
    By javaguy78 in forum Free Hosting
    Replies: 5
    Last Post: 03-27-2007, 02:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers