So I went ahead an answered my own question and created a TOC, which works, it spits out everything I wanted, accept the anchor tags don't work. it will not jump down the page to where the appropriate h1-6 tags are.I have the following php:\[code\]public function table_of_contents(&$content, $HeaderParameter){ //Creat Empty variables $HeaderNums = ""; $ContentLink = ""; $IndentLast = 1; //Creates a single string of header identifier. eg: "1234" foreach($HeaderParameter as $Num){ $HeaderNums.= $Num; } //Setup header to search for our headers specified by user if (preg_match_all('/<h(['.$HeaderNums.'])(.*?)>(.*?)(<\/h['.$HeaderNums.']>)/', $content, $Result)){ // Start Table $ContentLink.="<ul id='TB_UL'>"; // Go through each result and add to our list foreach ($Result[0] as $key => $title){ //Get header text $HeaderText = strip_tags($Result[0][$key]); // If user assign an ID then get it so that we can add our on $TagIdRegexOutput = split('"',$Result[2][$key]); // Check if user has already set an id, if so use theres if($TagIdRegexOutput[0]){ $TagRef = $TagIdRegexOutput[1]; } else{ $TagRef = $HeaderText; } //Set a level. $IndentPosCurrent = $Result[1][$key]; //Create link to header $ContentLink.='<li class="TB_Level' . $Result[1][$key] .'"><a class="TB_Link" href="http://stackoverflow.com/questions/15642526/#'.$TagRef.'">'.$HeaderText.'</a>'.'</li>'; // Create header tag $HeaderTag = "h".$Result[1][$key]; // Replace header in content with our assign id $content = str_replace($Result[0][$key], "<$HeaderTag"." id='$TagRef' ".">$HeaderText</$HeaderTag>", $content); } // End List $ContentLink.="</ul> <!-- TB_Main-->"; } echo $ContentLink; }\[/code\]Which spits out html like such:\[code\]<ul id="TB_UL"> <li class="TB_Level1"><a class="TB_Link" href="http://stackoverflow.com/questions/15642526/#Test">Test</a></li> <li class="TB_Level2"><a class="TB_Link" href="http://stackoverflow.com/questions/15642526/#More Test">More Test</a></li></ul>\[/code\]The #Test and #More Test are: \[code\]<h1>Test</h1>\[/code\] and \[code\]<h2>More Test</h2>\[/code\]Any thoughts?