[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/templates/ -> common_top_bts.php (source)

   1  <?php
   2  /*
   3  Contributed by: <-- R O B --> La Rochelle France
   4  Released under the GNU General Public License
   5  2004/01/29
   6  
   7  Automaticly shows all templates folders except the ones starting with an underscore
   8  (i.e.: "_my-secret-template-dir/")
   9  Just copy this file to your templates directory,
  10  and include it in your main_page.tpl.php files for example.
  11  */
  12  ?>
  13  <!-- BTSv1.4, current template: <?php echo DIR_WS_TEMPLATES; ?>-->
  14  <?php
  15  if (TEMPLATE_SWITCHING_ALLOWED == 'true')
  16  {
  17    echo '<div id="templateSwitcher" style="text-align: center; margin: 0px auto; font-size: 12px; border-top: 1px solid #777; border-bottom: 1px solid #777; background: #c0c0c0;">';
  18    echo 'Switch template:';
  19    $dir =  getcwd()."/templates/" ; /* get the current path and add "/templates/" to the end */
  20    if (is_dir($dir))
  21    {
  22      /* check if the path is a directory */
  23      if ($dh = opendir($dir))
  24      {
  25        /* create a file system object ($dh) */
  26        while (($file = readdir($dh)) !== false)
  27          {
  28            /* repeat with all the files in the directory */
  29            if(filetype($dir . $file) == "dir")
  30            {
  31              /* if the file in the directory is a folder */
  32              if($file != "..")
  33              {
  34                /* if the folder isn't called ".." (this is not a folder as such, I think its to go up one level?) */
  35                $firstchar = substr($file, 0, 1); // get the first character of the folder's name
  36                if(($firstchar != "_")&&($firstchar != "."))
  37                {
  38                  /* this means that any folder starting with "_" won't be displayed, allows to have secret template in the directory */
  39                  echo "<a style=\"color: blue; text-decoration: underline; margin: 5px;\" href=\"" . tep_href_link('index.php', 'tplDir='.$file) . "\">$file</a>";
  40                }
  41              }
  42            }
  43          }
  44        closedir($dh); /* close the file sytem object */
  45      }
  46    }
  47  echo '<br>Current template directory: ' .  '<span style="color: #f35c00; font-weight: bold;">' . DIR_WS_TEMPLATES . '</span>';
  48  echo '<br>Remove this menu by setting template switching allowed to false in admin, or by renaming "templates/common_top_bts.php".';
  49  echo '</div>';
  50  }
  51  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7