Bläddra i källkod

! Added page number to title and meta tags [Bug 3009]

emanuele 13 år sedan
förälder
incheckning
42792051e3
2 ändrade filer med 6 tillägg och 3 borttagningar
  1. 5 3
      Sources/Subs.php
  2. 1 0
      Themes/default/languages/index.english.php

+ 5 - 3
Sources/Subs.php

@@ -501,7 +501,7 @@ function updateSettings($changeArray, $update = false, $debug = false)
  */
 function constructPageIndex($base_url, &$start, $max_value, $num_per_page, $flexible_start = false)
 {
-	global $modSettings;
+	global $modSettings, $context;
 
 	// Save whether $start was less than 0 or not.
 	$start = (int) $start;
@@ -517,6 +517,8 @@ function constructPageIndex($base_url, &$start, $max_value, $num_per_page, $flex
 	else
 		$start = max(0, (int) $start - ((int) $start % (int) $num_per_page));
 
+	$context['current_page'] = $start / $num_per_page;
+
 	// Wireless will need the protocol on the URL somewhere.
 	if (WIRELESS)
 		$base_url .= ';' . WIRELESS_PROTOCOL;
@@ -2608,7 +2610,7 @@ function obExit($header = null, $do_footer = null, $from_index = false, $from_fa
 	{
 		// Was the page title set last minute? Also update the HTML safe one.
 		if (!empty($context['page_title']) && empty($context['page_title_html_safe']))
-			$context['page_title_html_safe'] = $smcFunc['htmlspecialchars'](un_htmlspecialchars($context['page_title']));
+			$context['page_title_html_safe'] = $smcFunc['htmlspecialchars'](un_htmlspecialchars($context['page_title'])) . (!empty($context['current_page']) ? ' - ' . $txt['page'] . ' ' . ($context['current_page'] + 1) : '');
 
 		// Start up the session URL fixer.
 		ob_start('ob_sessrewrite');
@@ -2965,7 +2967,7 @@ function setupThemeContext($forceload = false)
 		$context['page_title'] = '';
 
 	// Set some specific vars.
-	$context['page_title_html_safe'] = $smcFunc['htmlspecialchars'](un_htmlspecialchars($context['page_title']));
+	$context['page_title_html_safe'] = $smcFunc['htmlspecialchars'](un_htmlspecialchars($context['page_title'])) . (!empty($context['current_page']) ? ' - ' . $txt['page'] . ' ' . ($context['current_page'] + 1) : '');
 	$context['meta_keywords'] = !empty($modSettings['meta_keywords']) ? $smcFunc['htmlspecialchars']($modSettings['meta_keywords']) : '';
 }
 

+ 1 - 0
Themes/default/languages/index.english.php

@@ -93,6 +93,7 @@ $txt['warn_mute'] = 'Muted';
 $txt['message_index'] = 'Message Index';
 $txt['news'] = 'News';
 $txt['home'] = 'Home';
+$txt['page'] = 'Page';
 
 $txt['lock_unlock'] = 'Lock/Unlock Topic';
 $txt['post'] = 'Post';