Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Title - dynamiczny układ
aglar
post
Post #1





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 1.07.2009

Ostrzeżenie: (0%)
-----


Witam, jestem zielony z php, ale mysle ze przy waszej pomocy bede mogl zmodyfikowac jedna rzecz. Na swoim forum mam takie title:

  1. <?php
  2. <title>', $context['page_title'], '</title>;
  3. ?>


I jest tak ze dla kazdego page mam inny title. Jednakze title z glownej strony, chcialbym miec inne niz z page_title. Czy mozecie mi pomoc ulozyc taki kod, ktory by pozwalal na pozostawienie obecnego ustawienia title a jednoczesnie na mozliwosc ulozenia osobnego title dla glownej strony (index.php)?

Ten post edytował aglar 1.07.2009, 13:18:18
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
aglar
post
Post #2





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 1.07.2009

Ostrzeżenie: (0%)
-----


Oczywiscie. Idąc od góry:

  1. <?php
  2.  
  3. // Initialize the template... mainly little settings.
  4. function template_init()
  5. {
  6.    global $context, $settings, $options, $txt;
  7.  
  8.    /* Use images from default theme when using templates from the default theme?
  9.         if this is 'always', images from the default theme will be used.
  10.         if this is 'defaults', images from the default theme will only be used with default templates.
  11.         if this is 'never' or isn't set at all, images from the default theme will not be used. */
  12.    $settings['use_default_images'] = 'never';
  13.  
  14.    /* What document type definition is being used? (for font size and other issues.)
  15.         'xhtml' for an XHTML 1.0 document type definition.
  16.         'html' for an HTML 4.01 document type definition. */
  17.    $settings['doctype'] = 'xhtml';
  18.  
  19.    /* The version this template/theme is for.
  20.         This should probably be the version of SMF it was created for. */
  21.    $settings['theme_version'] = '1.1.5';
  22.  
  23.    /* Set a setting that tells the theme that it can render the tabs. */
  24.    $settings['use_tabs'] = false;
  25.  
  26.    /* Use plain buttons - as oppossed to text buttons? */
  27.    $settings['use_buttons'] = false;
  28.    $settings['use_image_buttons'] = true;
  29.    /* Show sticky and lock status seperate from topic icons? */
  30.    $settings['seperate_sticky_lock'] = true;
  31.  
  32. }
  33.  
  34. // The main sub template above the content.
  35. function template_main_above()
  36. {
  37.    global $context, $settings, $options, $scripturl, $txt, $language, $modSettings;
  38.  
  39.    // Show right to left and the character set for ease of translating.
  40.    echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  41. <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '><head>
  42.    <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
  43.    <meta name="description" content="', $context['page_title'], '" />', empty($context['robot_no_index']) ? '' : '
  44.    <meta name="robots" content="noindex" />', '
  45.    <meta name="keywords" content="PHP, MySQL, bulletin, board, free, open, source, smf, simple, machines, forum" />
  46.    <script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/script.js?fin11"></script>
  47.    <script language="JavaScript" type="text/JavaScript" src="http://www.xyz.pl/phpTACookie.js"></script>
  48.    <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
  49.        var smf_theme_url = "', $settings['theme_url'], '";
  50.        var smf_images_url = "', $settings['images_url'], '";
  51.        var smf_scripturl = "', $scripturl, '";
  52.        var smf_iso_case_folding = ', $context['server']['iso_case_folding'] ? 'true' : 'false', ';
  53.        var smf_charset = "', $context['character_set'], '";
  54.    // ]]></script>
  55.    if(basename($_SERVER['SCRIPT_FILENAME']) == 'index.php')
  56. {
  57. echo '<title>Title dla strony głównej ' . $context['page_title'] . ' albo z tej strony</title>';
  58. }
  59. else
  60. {
  61. echo '<title>' . $context['page_title'] . </title>;
  62. }
  63.  
  64.    // The ?finll part of this link is just here to make sure browsers don't cache it wrongly.
  65.     echo '
  66.    <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/style.css?fin11" />
  67.    <link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/print.css?fin11" media="print" />
  68.  
  69.    <!--[if lte IE 6]>
  70.        <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/ie6lte.css?fin11" />
  71.    <![endif]-->';
  72. ?>


Nie uzywam parsera, bo jak pisalem jestem zielony, ale chetnie zaglebie sie w swiat php zaczynajac od tego watku (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 25.12.2025 - 17:12