Jump to content

Search the Community

Showing results for tags 'active'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 5 results

  1. I followed a tutorial sometime back and now I want to use this script unfortunately the tutorial at the time did not cover what I am looking for but I did end up with the code below. I am wanting to have an active class dependant on users selection. I would appreciate any help. <?php echo '<ul id="nav">'; $cat_sql="SELECT * FROM administration"; $cat_query=mysqli_query($con, $cat_sql); // calling data put into associative array $cat_rs=mysqli_fetch_assoc($cat_query); do{ ?> <li><a <?php if ($current_page == "name") { ?><?php } ?>href="index.php?page=<?php echo $cat_rs['link_name']; ?>"><?php echo $cat_rs['name']; ?></a></li> <?php } while ($cat_rs=mysqli_fetch_assoc($cat_query)); echo "</ul>"; ?> <!-- need to add - class='active' --> The code above gets the field names for the buttons but I am unable to work out how to have an active class. The code is messy but have been trying all sorts to sort this. Thanks again for any pointers/help.
  2. Hi I'm using PHP for my Navigation Menu, My navbar is in a file named "home.php" looks like this: <ul class="nav navbar-nav navbar-right"> <li><a href="?page=home">Home</a></li> <li><a href="?page=about">About</a></li> <li><a href="?page=services">Services</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="?page=service2">Service 2</a></li> </ul> </ul> Then in my index.php: $page = $_GET['page']; if (!isset($page)) { include('home.php'); } if ($page == "home") { include('home.php'); } if ($page == "about") { include('about.php'); } if ($page == "services") { include('services.php'); } if ($page == "service2") { include('service2.php'); } It all works how I want it to except for one thing; I'd like to add; <li class="active"> To the page that is currently being viewed. How can I do this? Thank you in advance.
  3. Doesn't change status to expired. <?php $bannersQuery = 'SELECT * FROM banners WHERE expire > NOW() AND status = "active" ORDER BY RAND() LIMIT 10'; $banners = $db->query($bannersQuery); while($row = $banners->fetch(PDO::FETCH_ASSOC)){ if($row['expire'] <= time()){ $status = 'expired'; }else{ $status = 'active'; } $updateQuery = 'UPDATE banners SET exposures = exposures + 1, status = :status WHERE id = :id'; $update = $db->prepare($updateQuery); $update->bindParam(':status', $status, PDO::PARAM_STR); $update->bindParam(':id', $row['id'], PDO::PARAM_INT); $update->execute(); echo ' <a href="index.php?do=bannerClick&id='.$row['id'].'" target="_BLANK"><img src="'.$row['url'].'" width="'.$row['width'].'" height="'.$row['height'].'" alt="'.$row['title'].'"></a><br>'; } echo ' <a href="index.php?do=buyBanner">Want to advertise your banner? Click here.</a>'; ?>
  4. Hi everybody and congratulations for being part of this forum. Well the case is that being a beginner in this thing called php, I am looking for an elegant, functional way to detect active categories in a Joomla!-based site. The idea is to apply certain css rules to an entire site when certain categories are active. In fact, specific css styles for each active category. The administrator in charge of the site will not have any control over the css files and their implementation, so I have to leave the site prepared in terms of styling. The site will have a good number of categories to be activated and deactivated whenever the webmaster consider the opportunity. Do you know some approach to the problem? Some practical example or idea. Best regards.
  5. Hi Guys, I have the below code that I am trying to make work correctly, basically it creates a menu structure and then should only make the parent active if the page you are on belongs to that parent. at the moment the structure is wrong as it is adding too many <ul> entries for each menu. this is what it currently does: <ul id="nav"> <li class="active"><a href="admin.php">System Settings</a> <ul id="nav"> <li><a href="reports.php">Reports</a></il> </ul> <ul id="nav"> <li><a href="memblst.php?opt=createuser">Create User</a></il> </ul> </li> </ul> This is what it should be: <ul id="nav"> <li class="active"><a href="admin.php">System Settings</a> <ul> <li><a href="reports.php">Reports</a></il> <li><a href="memblst.php?opt=createuser">Create User</a></il> </ul> </li> </ul> $MENU["SYSTEMS"] = array ( 'parent'=>true, 'enabled'=>true, 'text'=>'System Settings', 'link'=> 'admin.php', 'sub_modules' => array('REPORTS','CREATE_USER') ); $MENU["REPORTS"] = array ( 'parent'=>FALSE, 'enabled'=>true, 'text'=>'Reports', 'link'=> 'reports.php', 'sub_modules' => array() ); $MENU["CREATE_USER"] = array ( 'parent'=>FALSE, 'enabled'=>true, 'text'=>'Create User', 'link'=> 'memblst.php?opt=createuser', 'sub_modules' => array() ); $MENU["MEMBER_LST"] = array ( 'parent'=>FALSE, 'enabled'=>true, 'text'=>'Member List', 'link'=> 'memberlst.php', 'sub_modules' => array() ); $MENU["SYSTEM_LOGS"] = array ( 'parent'=>FALSE, 'enabled'=>true, 'text'=>'System Logs', 'link'=> 'syslog.php', 'sub_modules' => array() ); function show_menu(&$MENU,$subIndex=false){ $menu_string = ''; $menu_string .= '<ul id="nav">'; if(!$subIndex){ foreach($MENU as $item) { if( $item['enabled']&&$item['parent'] ) { $_subString=""; if(!empty($item['sub_modules'])){ foreach($item['sub_modules'] as $sub){ $_subString .= show_menu($MENU,$sub); } } $menu_string .= '<li class="active"><a href="'.$item['link'].'">'.$item['text'].'</a>'.$_subString.'</li>'; } } }else{ if(@$MENU[$subIndex]['enabled']&&!@$MENU[$subIndex]['parent']) { $_subString=""; if(!empty($MENU[$subIndex]['sub_modules'])){ foreach($MENU[$subIndex]['sub_modules'] as $sub){ $_subString .= show_menu($MENU,$sub); } } $menu_string .= '<li><a href="'.$MENU[$subIndex]['link'].'">'.$MENU[$subIndex]['text'].'</a></il>'.$_subString; } } return $menu_string.'</ul>'; } echo show_menu($MENU);
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.