mnybud Posted July 31, 2007 Share Posted July 31, 2007 Can someone tell me how I would alter this code, which displays a list of my site pages as a single sitemap page, to generate multiple sitemap pages (like 20 links per sitemap page or something) with next and previous buttons? Trying to avoid having a ton of links on one page.....any help is appreciated! <?php // SITEMAP function sitemap($return = false) { $sitemap = ''; $sitemap = ''; $keyword_file = file(FILE_KEYWORDS); $keyword_file = array_map('trim', $keyword_file); $keyword_file = str_replace(" ", "-", $keyword_file); asort($keyword_file); $letters = ""; $letters = explode(" ", $letters); foreach($letters as $letter) { $links[$letter] = ''; foreach($keyword_file as $keyword) { if (preg_match("/^$letter/i", $keyword)) { $links[$letter] .= $keyword." "; } } $links[$letter] = rtrim($links[$letter]); if ($links[$letter] !== '') { $links2 = explode(" ", $links[$letter]); $letter = str_replace("\d","#",$letter); $sitemap .= "\n"."<a name=\"".$letter."\" id=\"".$letter."\"></a>"; $sitemap .= "\n"."<h1>".$letter."</h1>"; foreach($links2 as $keyword) { $keyword = str_replace("-", " ", $keyword); $sitemap .= "\n".'<a href="http://'.THIS_DOMAIN.'/'.str_replace(" ", "-", $keyword).'" title="'.$keyword.'">'.$keyword.'</a><br />'; } } } $sitemap .= "\n"; if ($return !== true) { print $sitemap; } else { return $sitemap; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/62755-create-multiple-pages/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.