Fixed more and multiple page code to use new permalink system.

git-svn-id: http://svn.automattic.com/wordpress/trunk@600 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2003-12-10 19:06:28 +00:00
parent 28cad83a06
commit 089dda9710
2 changed files with 34 additions and 22 deletions

View File

@ -872,9 +872,9 @@ function get_the_content($more_link_text='(more...)', $stripteaser=0, $more_file
$output .= $teaser;
if (count($content)>1) {
if ($more) {
$output .= '<a name="more'.$id.'"></a>'.$content[1];
$output .= '<a id="more-'.$id.'"></a>'.$content[1];
} else {
$output .= ' <a href="'.$file.$querystring_start.'p'.$querystring_equal.$id.$querystring_separator.'more'.$querystring_equal.'1#more'.$id.'">'.$more_link_text.'</a>';
$output .= " <a href='". get_permalink() . "#more-$id'>$more_link_text</a>";
}
}
if ($preview) { // preview fix for javascript bug with foreign languages
@ -985,16 +985,19 @@ function link_pages($before='<br />', $after='<br />', $next_or_number='number',
} else {
$file = $pagenow;
}
if (($multipage)) { // && ($more)) {
if (($multipage)) {
if ($next_or_number=='number') {
echo $before;
for ($i = 1; $i < ($numpages+1); $i = $i + 1) {
$j=str_replace('%',"$i",$pagelink);
echo " ";
if (($i != $page) || ((!$more) && ($page==1)))
echo '<a href="'.$file.$querystring_start.'p'.$querystring_equal.$id.
$querystring_separator.'more'.$querystring_equal.'1'.
$querystring_separator.'page'.$querystring_equal.$i.'">';
if (($i != $page) || ((!$more) && ($page==1))) {
if ('' == get_settings('permalink_structure')) {
echo '<a href="'.get_permalink().$querystring_separator.'page'.$querystring_equal.$i.'">';
} else {
echo '<a href="'.get_permalink().$i.'/">';
}
}
echo $j;
if (($i != $page) || ((!$more) && ($page==1)))
echo '</a>';
@ -1004,17 +1007,21 @@ function link_pages($before='<br />', $after='<br />', $next_or_number='number',
if ($more) {
echo $before;
$i=$page-1;
if ($i && $more)
echo ' <a href="'.$file.$querystring_start.'p'.$querystring_equal.$id.
$querystring_separator.'more'.$querystring_equal.'1'.
$querystring_separator.'page'.$querystring_equal.$i.'">'.
$previouspagelink.'</a>';
if ($i && $more) {
if ('' == get_settings('permalink_structure')) {
echo '<a href="'.get_permalink().$querystring_separator.'page'.$querystring_equal.$i.'">';
} else {
echo '<a href="'.get_permalink().$i.'/">';
}
}
$i=$page+1;
if ($i<=$numpages && $more)
echo ' <a href="'.$file.$querystring_start.'p'.$querystring_equal.$id.
$querystring_separator.'more'.$querystring_equal.'1'.
$querystring_separator.'page'.$querystring_equal.$i.'">'.
$nextpagelink.'</a>';
if ($i<=$numpages && $more) {
if ('' == get_settings('permalink_structure')) {
echo '<a href="'.get_permalink().$querystring_separator.'page'.$querystring_equal.$i.'">';
} else {
echo '<a href="'.get_permalink().$i.'/">';
}
}
echo $after;
}
}

View File

@ -132,8 +132,11 @@ $query = 'index.php?';
for ($i = 0; $i < count($tokens[0]); ++$i) {
if (0 < $i) $query .= '&';
$query .= str_replace($rewritecode, $queryreplace, $tokens[0][$i]) . '$'. ($i + 1);
}
++$i;
// Add post paged stuff
$match .= '([0-9]+)?/?';
$query .= "&page=$$i";
// Code for nice categories, currently not very flexible
$front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));
@ -141,10 +144,12 @@ $front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));
$catmatch = preg_replace('|^/+|', '', $catmatch);
?>
<p><code>RewriteEngine On<br />
RewriteBase <?php echo $site_root; ?><br />
RewriteRule ^<?php echo $match; echo '$ ' . $site_root . $query ?> [QSA]<br />
RewriteRule ^<?php echo $catmatch; ?>(.*) <?php echo $site_root; ?>index.php?category_name=$1 [QSA]</code></p>
<form action"">
<textarea rows="5" style="width: 100%;">RewriteEngine On
RewriteBase <?php echo $site_root; ?>
RewriteRule ^<?php echo $match; echo '$ ' . $site_root . $query ?> [QSA]
RewriteRule ^<?php echo $catmatch; ?>(.*) <?php echo $site_root; ?>index.php?category_name=$1 [QSA]</textarea>
</form>
</div>
<?php
} else {