SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,643
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    create a filter?

    I bought an event calendar and installed it at
    http://fixmysite.us/coronadoshores/c...p?mo=9&yr=2012
    (the filtering option is what im trying to modify)
    So if you take a look at how this guy did it,
    http://bridgeoflife.org/calendar/index.php
    (I tike the colored list with links instead of my form)
    Heres the PHP code for that form,
    PHP Code:
    <?php 
    //////////////////////////////////////////////////
    // DISPLAY MAIN CATEGORIES DROP-DOWN /////////////
    //////////////////////////////////////////////////
    /*
    This plugin will display a single drop-down menu with the Main Category selections.
    */

    if (!isset($epcCategories) || $epcCategories=="" || isset($_REQUEST['epcCategories'])) exit;

    $epcCat explode("-||-",$epcCategories);

    // DISCARD ARRAY KEY INFORMATION
    $epcHighKeyX explode("|",array_pop($epcCat));

    // ASSIGN EACH CATEGORY WTTH SELECTIONS TO AN ARRAY
    if (count($epcCat)>0) {

      
    // RESET COUNTER
      
    $epcCatCount 0;

      while (list(
    $key$epcValue) = each($epcCat)) {
        if (
    $epcValue!="") {
          
    $epcCategoryHolder[$epcCatCount] = $epcValue;
          
    $epcCatCount++;
          }
        }
      }

      
    // SHOW CATEGORY
      
    $epcValue $epcCategoryHolder[0];

      
    $epcCatFull explode("|",$epcValue);

      
    // SET CATEGORY NAMES
      
    $epcCatNameSet $epcCatFull[1];
      
    $epcCatNameSet explode("[",$epcCatNameSet);
      
    $epcCategoryNames[$epcCatNameSet[1]] = $epcCatNameSet[0];

      
    // DISPLAY CATEGORY NAME
      //echo $epcCatNameSet[0].": ";

      // SHORTEN SELECTIONS ARRAY
      
    array_shift($epcCatFull);
      
    array_shift($epcCatFull);

      
    // SORT SELECTIONS
      
    asort($epcCatFull);
      
    reset($epcCatFull);

      
    // SHOW DROP DOWN FORM
      
    ?>
    <form action="<?php echo $thisFile ?>" method="get" name="FilterForm" id="FilterForm">
    <select name="showCat" id="showCat">
    <option value="">Show All</option>
    <?php

      
    // SET SELECTIONS NAMES
      
    while (list($keyX$key) = each($epcCatFull)) {
        
    $epcSelFull explode("[",$key);
        if (
    $epcSelFull[0]!="") {

          echo 
    "<option value=\"$epcSelFull[1]\"";
          if (
    $_REQUEST['showCat']==$epcSelFull[1]) echo " selected";
          echo 
    ">".$epcSelFull[0]."</option>";
          }
        }
    ?>
    </select>
    <?php
    // CHECK ev IS VALID
    if (isset($_REQUEST['ev'])) {
      if (!
    is_numeric($_REQUEST['ev']) || $_REQUEST['ev']<1$_REQUEST['ev']="";
      }

    // CHECK mo AND yr ARE VALID
    if (!isset($mo)) $mo=$_REQUEST['mo'];
    if (!isset(
    $yr)) $yr=$_REQUEST['yr'];
    if (!
    is_numeric($mo)) unset($mo);
    if (
    $mo<|| $mo>12) unset($mo);
    if (!
    is_numeric($yr)) unset($yr);
    if (
    $yr "-4712" || $yr 3267) unset($yr);
    ?>
    <input type="submit" name="Submit" value="Filter">
    <input name="mo" type="hidden" id="mo" value="<?php echo $mo ?>" />
    <input name="yr" type="hidden" id="yr" value="<?php echo $yr ?>" />
    <input name="ev" type="hidden" id="ev" value="<?php echo $_REQUEST['ev'?>" />
    </form>
    I tried to do this myself,
    http://fixmysite.us/coronadoshores/easycalendar.php
    But it doesnt work so I need some help, heres my php code for that
    PHP Code:
    <?php 
    ///////////////////////////////////////////////
    // DISPLAY MAIN CATEGORIES LEGEND WITH A FILTER/////////////
    ///////////////////////////////////////////////
    /*
    This plugin will display a the legend which will link to each category...
    */

    if (!isset($epcCategories) || $epcCategories=="" || isset($_REQUEST['epcCategories'])) exit;

    $epcCat explode("-||-",$epcCategories);

    // DISCARD ARRAY KEY INFORMATION
    $epcHighKeyX explode("|",array_pop($epcCat));

    // ASSIGN EACH CATEGORY WTTH SELECTIONS TO AN ARRAY
    if (count($epcCat)>0) {

      
    // RESET COUNTER
      
    $epcCatCount 0;

      foreach (
    $epcCat as $epcValue) {
        if (
    $epcValue!="") {
          
    $epcCategoryHolder[$epcCatCount] = $epcValue;
          
    $epcCatCount++;
          }
        }
      }

      
    // SHOW CATEGORY
      
    $epcValue $epcCategoryHolder[0];

      
    $epcCatFull explode("|",$epcValue);

      
    // SET CATEGORY NAMES
      
    $epcCatNameSet $epcCatFull[1];
      
    $epcCatNameSet explode("[",$epcCatNameSet);
      
    $epcCategoryNames[$epcCatNameSet[1]] = $epcCatNameSet[0];

      
    // SHORTEN SELECTIONS ARRAY
      
    array_shift($epcCatFull);
      
    array_shift($epcCatFull);

      
    // SORT SELECTIONS
      
    asort($epcCatFull);
      
    reset($epcCatFull);

      
    //////////////////////
      // BEGIN TABLE CODE //
      //////////////////////
    ?>
    <?php
    // CHECK ev, mo AND yr ARE VALID
    if (!isset($mo)) $mo=$_REQUEST['mo'];
    if (!isset(
    $yr)) $yr=$_REQUEST['yr'];
    if (!isset(
    $ev)) $yr=$_REQUEST['ev'];
    if (!
    is_numeric($mo)) unset($mo);
    if (
    $mo<|| $mo>12) unset($mo);
    if (!
    is_numeric($yr)) unset($yr);
    if (
    $yr "-4712" || $yr 3267) unset($yr);
    if (
    $ev "1") unset($yr);
    ?>
    <style type="text/css">
    <!--
    .ledCatName {
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 10px;
        text-align: left;
    }
    -->
    </style>
    <table width="200">
    <?php

      
    // SET SELECTIONS NAMES
      
    foreach ($epcCatFull as $key) {
        
    $epcSelFull explode("[",$key);
        if (
    $epcSelFull[0]!="") {

          
    ?>
          <tr><td width="15" class="s2<?php echo $epcSelFull[1]; ?> ledCatName">&nbsp;</td>
          <td>
          <a href="<?php echo "?ev=".$ev."&ampmo=".$mo."&amp;yr=".$yr?>">
          <span class="ledCatName"><?php echo $epcSelFull[0]; ?></span>
          </a></td></tr>
          <?php
          
    }
        }

    // SHOW MULTI-EVENTS COLOR
    if ($epcMultiCatShow==1) {
       
    ?>
        <tr><td width="15" class="s29999 ledCatName">&nbsp;</td>
        <td><span class="ledCatName">Multiple Categories</span></td></tr>
        <?php
      
    }

    ?>
    </table>
    What am I missing?

    Thanks...
    "Oh, and Jenkins--apparently your mother died this morning."

  2. #2
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,643
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    nevermind, found another solution
    "Oh, and Jenkins--apparently your mother died this morning."


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •