We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25663 MODX Staff
    • 12,272 Posts
    Thanks smiley
      Ryan Thrash, MODX Co-Founder
      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
      • 10449
      • 956 Posts
      Quote from: davidm at Jan 22, 2008, 03:16 AM

      but I have another question : can I link from a tab to another ?

      This should work:

      <a href="#" onclick="tpResources.setSelectedIndex(0); return false;">Test-Link</a>
      


      0 = 1st tab
      1 = 2nd tab
      etc.

      see API section: http://webfx.eae.net/dhtml/tabpane/tabpane.html
        • 7231
        • 4,205 Posts
        Then just sort by filenames, but strip out the first two characters for the tab-display.
        This is very clever thinking.
          [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

          Something is happening here, but you don&#39;t know what it is.
          Do you, Mr. Jones? - [bob dylan]
          • 6726
          • 7,075 Posts
          This is cool, thanks a ton ganeshXL !

          ;D
            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l&#39;outil id
            • 6726
            • 7,075 Posts
            Hmmm, I must have bogged the copy paste somewhere along the lines, but being close to php illiterate, I don’t see it tongue

            With the latest modified version I have :


            <?php
            if ($handle = opendir('help')) {
                while (false !== ($file = readdir($handle))) {
                    if ($file != "." && $file != "..") {
                    $help[] = $file;
                   }
                }
                closedir($handle);
            }
            
            natcasesort($help);
            
            foreach($help as $k=>$v) {
            	$helpname =  substr($v, 0, strrpos($v, '.'));
            
            	$prefix = substr($helpname, 0, 2);
            	if(is_numeric($prefix)) {
            		$helpname =  substr($helpname, 2, strlen($helpname)-1 );
            	}
            
            	$helpname = str_replace('_', ' ', $helpname);
            }
            
            ?>



            ???
              .: COO - Commerce Guys - Community Driven Innovation :.


              MODx est l&#39;outil id
              • 25663 MODX Staff
              • 12,272 Posts
              I think you left off the bit that acutally builds the tabs:
              <?php
              if ($handle = opendir('help')) {
                  while (false !== ($file = readdir($handle))) {
                      if ($file != "." && $file != "..") {
                          $help[] = $file;
                      }
                  }
                  closedir($handle);
              }
              
              
              natcasesort($help);
              
              foreach($help as $k=>$v) {
              
                  $helpname =  substr($v, 0, strrpos($v, '.'));
              
                  $prefix = substr($helpname, 0, 2);
                  if(is_numeric($prefix)) {
                      $helpname =  substr($helpname, 2, strlen($helpname)-1 );
                  }
              
                  $helpname = str_replace('_', ' ', $helpname);
              
                  echo '<div class="tab-page" id="tab'.$v.'Help">';
                  echo '<h2 class="tab">'.$helpname.'</h2>';
                  echo '<script type="text/javascript">tpResources.addTabPage( document.getElementById( "tab'.$v.'Help" ) );</script>';
                  include "./help/$v";
                  echo '</div>';
              }
              ?>
              
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 6726
                • 7,075 Posts
                Dumb me rolleyes

                Thanks Ryan !
                Works like a charm cool
                  .: COO - Commerce Guys - Community Driven Innovation :.


                  MODx est l&#39;outil id
                  • 7231
                  • 4,205 Posts
                  This is very cool, but I have one issue. It is creating a tab for .DS_store as well as the files in the help directory. This not really an issue on the live server (in my case) but on a Mac server this could be a hassle. The tab shows up with no name since the $helpname gets the title from before the . but the tab shows up with the content to the DS_Store file.

                  Is there a way to make sure that it only opens php or html files.
                    [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                    Something is happening here, but you don&#39;t know what it is.
                    Do you, Mr. Jones? - [bob dylan]
                    • 10449
                    • 956 Posts
                    Those silly fruit-computers... tongue

                    Try this:

                    if ($file != "." && $file != ".." && $file != ".DS_store") {

                    instead of
                    if ($file != "." && $file != "..") {
                      • 7231
                      • 4,205 Posts
                      Thanks, that did it. grin

                      Now I have another problem. when transfering another site to the final server the tabs show up but the content does not load and there is no error message. I figure that it is somehow related to the include statement and have tried the complete server path with no luck.

                      Any ideas why the content may not load?
                      include "./help/$v";
                        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                        Something is happening here, but you don&#39;t know what it is.
                        Do you, Mr. Jones? - [bob dylan]