Sie sind hier: Typo3 CodeBase / Typoscript - Typo3 / Menus / Menu Typoscript für eine Select Box die zu den einzelnen Header Anchor Links leitet

Menu Typoscript für eine Select Box die zu den einzelnen Header Anchor Links leitet

# JS Datei für die Action...
 
page.headerData.44 = TEXT
page.headerData.44.value = <script type="text/javascript" src="fileadmin/site_scripts/jsmenu.js" language="JavaScript"></script>
 
#IProcFunc
 
includeLibs.jsmenu = fileadmin/site_scripts/jsmenu.inc
 
# Das eig TS
 
test.menu = HMENU
test.menu {
 
     # Level 1 ÜBER der Zielseite
      entryLevel = 4
      wrap = <form name="jumpmenu"><select name="jumpmenu_product" id="jumpmenu_anchors" onChange="MM_jumpMenu('parent',this,1)"><option value="http://www.yourdomain.com/">Gehe zu...</option>|</select></form>    
	1 = TMENU
	1.sectionIndex = 1
	1.sectionIndex.type = header
	1.IProcFunc = user_jsmenu->build 
        1.NO.linkWrap = |
        1.NO.allWrap = |
        1.NO.ATagBeforeWrap = 1 
} 
 
lib.JUMPMENU = COA
lib.JUMPMENU.10 < test.menu
 
 
JSMENU.INC DATEI!!
 
<?php
class user_jsmenu{
	function build($I,$conf) {
		$pids[]=$GLOBALS[TSFE]->id;
		foreach ($GLOBALS[TSFE]->rootLine as $data){
			$pids[]=$data[pid];
		}
		$pids=join(",",$pids);
		$query='SELECT domainName from sys_domain WHERE pid IN('.$pids.')';
		$res=$GLOBALS['TYPO3_DB']->exec_SELECTquery('domainName', 'sys_domain', 'pid IN('.$pids.')', $groupBy='', $orderBy='sorting ASC', '1');
		#t3lib_div::debug($res);
		$row=$GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
		#t3lib_div::debug($row);
 
		$selected='';
		$class=' class="option"';
		if ($I["pid"]!=6)$class=' class="option_sub"';
		if ($GLOBALS[TSFE]->id==$I["uid"]){
			#$selected=' selected="selected"';
			$class=' class="option_sel"';
		}
 
		$I["parts"]["title"] = str_replace("|", " ", $I["parts"]["title"]);
		$I["parts"]["ATag_begin"] = '<option value="http://'.$row["domainName"]."/".$I["linkHREF"]["HREF"].'" '.$selected.' '.$class.'>';
		$I["parts"]["ATag_end"] = "</option>\n";
		return $I;
	}
}
?>
jsmenu.js DATEI
 
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
 
function MM_findObj(n, d) { //v4.01
  var p,i,x;
  if(!d) d=document;
  if((p=n.indexOf("?"))>0&&parent.frames.length){
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
    }
  if(!(x=d[n])&&d.all) x=d.all[n];
  for (i=0;!x&&i<d.forms.length;i++){
      x=d.forms[i][n];
  }
  for(i=0;!x&&d.layers&&i<d.layers.length;i++){
      x=MM_findObj(n,d.layers[i].document);
  }
  if(!x && d.getElementById) x=d.getElementById(n);
  return x;
}
 
function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName);
  if (selObj) MM_jumpMenu(targ,selObj,restore);
}
//-->

So sieht es dann aus wenn es klappt...

wählt man dann einen Punkt aus wird man zum jeweiligen Header gescrollt.

WICHTIG: Es müssen einzelne Content Elemente sein wo der header im feld header steht! Wenn ein Header im RTE deklariert wird erstellt typo3 keinen Anchor und der Section Index klappt dann nicht.