Tinklapio 'title' patobulinimas
Parašė Enzo 2008 birželio 28 19:06:27
Tinklapio 'title' patobulinimas pvz:

Diskusijų forumas - jususaitas.info

Taigi atsidarykite subheader.php

ir susiraskite:

[code]<head>
<title>".$settings['sitename']."</title>[/code]

tada jį keiskite:

[code]<head>";
include_once INCLUDES."dynamic_titles.php";

echo "<title>".$title.$settings['sitename']."</title>[/code]

Tuomet susikurkite: dynamic_titles.php failą ir jį rašykite:

[code]<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2005 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
if (!defined("IN_FUSION")) { header("Location: ../index.php"); exit; }

if (file_exists(LOCALE.LOCALESET."dynamic_titles.php")) {
include LOCALE.LOCALESET."dynamic_titles.php";
} else { include LOCALE."English/dynamic_titles.php"; }

function dynamic_title($column, $table, $compare1, $compare2, $begin, $alt) {
global $db_prefix;
if (!isnum($compare2)) { $compare2 = 0; }
$result = dbquery("SELECT $column FROM ".$db_prefix."$table WHERE $compare1 = $compare2");
if ($result) {
$data = dbarray($result);
$title = $begin.$data[$column];
} else {
$title = $alt;
}
return $title;
}

if(FUSION_SELF == "submit.php") {
if($_GET['stype'] == "l") $title = $locale['DTM_059'];
if($_GET['stype'] == "n") $title = $locale['DTM_060'];
if($_GET['stype'] == "a") $title = $locale['DTM_061'];
} elseif(FUSION_SELF == "register.php") {
$title = $locale['DTM_062'];
} elseif(FUSION_SELF == "search.php") {
$title = $locale['DTM_063'];
} elseif(FUSION_SELF == "edit_profile.php") {
$title = $locale['DTM_064'];
} elseif(FUSION_SELF == "members.php") {
$title = $locale['DTM_065'];
} elseif(FUSION_SELF == "guestbook.php") {
$title = $locale['DTM_068'];
} elseif(FUSION_SELF == "lostpassword.php") {
$title = $locale['DTM_066'];
} elseif(FUSION_SELF == "contact.php") {
$title = $locale['DTM_067'];
} elseif(FUSION_SELF == "post.php") {
if($_GET['action'] == "newthread") {
$title = dynamic_title("forum_name", "forums", "forum_id", $_GET['forum_id'], $locale['DTM_020'], $locale['DTM_021']);
} elseif($_GET['action'] == "edit") {
$title = dynamic_title("post_subject", "posts", "post_id", $_GET['post_id'], $locale['DTM_026'], $locale['DTM_027']);
} elseif($_GET['action'] == "reply") {
$title = dynamic_title("thread_subject", "threads", "thread_id", $_GET['thread_id'], $locale['DTM_032'], $locale['DTM_033']);
}
} elseif(FUSION_SELF == "postify.php") {
if($_GET['post'] == "new" && $_GET['error'] == 0) {
$title = dynamic_title("forum_name", "forums", "forum_id", $_GET['forum_id'], $locale['DTM_022'], $locale['DTM_023']);
} elseif($_GET['post'] == "new" && $_GET['error'] != 0) {
$title = dynamic_title("forum_name", "forums", "forum_id", $_GET['forum_id'], $locale['DTM_024'], $locale['DTM_025']);
} elseif($_GET['post'] == "edit" && $_GET['error'] == 0) {
$title = dynamic_title("post_subject", "posts", "post_id", $_GET['post_id'], $locale['DTM_028'], $locale['DTM_029']);
} elseif($_GET['post'] == "edit" && $_GET['error'] != 0) {
$title = dynamic_title("post_subject", "posts", "post_id", $_GET['post_id'], $locale['DTM_030'], $locale['DTM_031']);
} elseif($_GET['post'] == "reply" && $_GET['error'] == 0) {
$title = dynamic_title("thread_subject", "threads", "thread_id", $_GET['thread_id'], $locale['DTM_034'], $locale['DTM_035']);
} elseif($_GET['post'] == "reply" && $_GET['error'] != 0) {
$title = dynamic_title("thread_subject", "threads", "thread_id", $_GET['thread_id'], $locale['DTM_036'], $locale['DTM_037']);
}
} elseif(FUSION_SELF == "messages.php") {
if(isset($msg_view)) {
$title = dynamic_title("message_subject", "messages", "message_id", $msg_view, $locale['DTM_044'], $locale['DTM_045']);
} elseif(isset($msg_reply)) {
$title = dynamic_title("message_subject", "messages", "message_id", $msg_reply, $locale['DTM_046'], $locale['DTM_047']);
} elseif(isset($_POST['reply_preview'])) {
$title = dynamic_title("message_subject", "messages", "message_id", $msg_reply_preview, $locale['DTM_048'], $locale['DTM_049']);
} elseif(isset($msg_send)) {
$title = dynamic_title("user_name", "users", "user_id", $msg_send, $locale['DTM_050'], $locale['DTM_051']);
} elseif(isset($_POST['send_preview'])) {
$title = dynamic_title("user_name", "users", "user_id", $msg_to, $locale['DTM_052'], $locale['DTM_053']);
} elseif(isset($folder)) {
if($folder == "inbox") $title = $locale['DTM_040'];
elseif($folder == "sentbox") $title = $locale['DTM_041'];
elseif($folder == "savebox") $title = $locale['DTM_042'];
elseif($folder == "options") $title = $locale['DTM_043'];
else $title = $locale['DTM_028'];
} else {
$title = $locale['DTM_039'];
}
} elseif(FUSION_SELF == "photogallery.php") {
if(isset($album)) {
$title = dynamic_title("album_title", "photo_albums", "album_id", $album, $locale['DTM_055'], $locale['DTM_056']);
} elseif(isset($photo)) {
$title = dynamic_title("photo_title", "photos", "photo_id", $photo, $locale['DTM_057'], $locale['DTM_058']);
} else {
$title = $locale['DTM_054'];
}
} elseif(FUSION_SELF == "index.php") {
if(BASEDIR.basename(dirname($_SERVER['PHP_SELF']))."/" == FORUM) $title = $locale['DTM_038'];
} else {
$page_array = array(
array("news.php", "news_subject", "news", "news_id", (isset($readmore)? $readmore : ""), $locale['DTM_000'], $locale['DTM_001']),
array("news_cats.php", "news_cat_name", "news_cats", "news_cat_id", (isset($cat_id)? $cat_id : ""), $locale['DTM_002'], $locale['DTM_003']),
array("articles.php", "article_cat_name", "article_cats", "article_cat_id", (isset($cat_id)? $cat_id : ""), $locale['DTM_004'], $locale['DTM_005']),
array("readarticle.php", "article_subject", "articles", "article_id", (isset($article_id)? $article_id : ""), $locale['DTM_006'], $locale['DTM_007']),
array("downloads.php", "download_cat_name", "download_cats", "download_cat_id", (isset($cat_id)? $cat_id : ""), $locale['DTM_008'], $locale['DTM_009']),
array("faq.php", "faq_cat_name", "faq_cats", "faq_cat_id", (isset($cat_id)? $cat_id : ""), $locale['DTM_010'], $locale['DTM_011']),
array("profile.php", "user_name", "users", "user_id", (isset($lookup)?$lookup:""), $locale['DTM_012'], $locale['DTM_013']),
array("weblinks.php", "weblink_cat_name", "weblink_cats", "weblink_cat_id", (isset($cat_id)? $cat_id : ""), $locale['DTM_014'], $locale['DTM_015']),

array("viewthread.php", "thread_subject", "threads", "thread_id", (isset($thread_id)?$thread_id:""), $locale['DTM_018'], $locale['DTM_019']),
array("viewpage.php", "page_title", "custom_pages", "page_id", (isset($page_id)?$page_id:""), "", "")
);
foreach($page_array as $value) {
if($value[0] == FUSION_SELF && $value[4] > "") {
$title = dynamic_title($value[1], $value[2], $value[3], $value[4], $value[5],$value[6]);
} elseif($value[0] == FUSION_SELF) {
$title = $value[6];
}
}
}

if(!empty($title)) $title = $title." - ";

?>[/code]

Tada susikurkite dar vieną dynamic_titles.php

ir į jį rašykite

[code]<?php

$locale['DTM_000'] = "Naujienos: ";
$locale['DTM_001'] = "Naujienos";
$locale['DTM_002'] = "Naujienø kategorija: ";
$locale['DTM_003'] = "Naujienø kategorijos";
$locale['DTM_004'] = "Straipsniai: ";
$locale['DTM_005'] = "Straipsniai";
$locale['DTM_006'] = "Read Article: ";
$locale['DTM_007'] = "Read Article";
$locale['DTM_008'] = "Siuntiniai: ";
$locale['DTM_009'] = "Siuntiniai";
$locale['DTM_010'] = "DUK: ";
$locale['DTM_011'] = "DUK";
$locale['DTM_012'] = "Vartotojo profilis: ";
$locale['DTM_013'] = "Vartotojo profilis";
$locale['DTM_014'] = "Web Nuorodos: ";
$locale['DTM_015'] = "Web Nuorodos";
$locale['DTM_016'] = "&#222;i&#251;r&#235;ti forum&#224;: ";
$locale['DTM_017'] = "&#222;i&#251;r&#235;ti forum&#224;";
$locale['DTM_018'] = "&#222;i&#251;r&#235;ti tem&#224;: ";
$locale['DTM_019'] = "&#222;i&#251;r&#235;ti tem&#224;";
$locale['DTM_020'] = "Skelbti nauj&#224; tem&#224; ";
$locale['DTM_021'] = "Skelbti nauj&#224; tem&#224;";
$locale['DTM_022'] = "Nauja tema paskelbta ";
$locale['DTM_023'] = "Nauja tema paskelbta";
$locale['DTM_024'] = "Klaida, skelbiant nauj&#224; tem&#224; ";
$locale['DTM_025'] = "Klaida, skelbiant nauj&#224; tem&#224;";
$locale['DTM_026'] = "Redaguoti prane&#240;im&#224;: ";
$locale['DTM_027'] = "Redaguoti prane&#240;im&#224;";
$locale['DTM_028'] = "Pakeitimus saugoti &#225; ";
$locale['DTM_029'] = "Pakeitimai i&#240;saugoti";
$locale['DTM_030'] = "Klaida saugant nustatymus &#225; ";
$locale['DTM_031'] = "Klaida saugant nustatymus";
$locale['DTM_032'] = "Atsakyti &#225; tem&#224;: ";
$locale['DTM_033'] = "Atsakyti &#225; tem&#224;";
$locale['DTM_034'] = "Atsakymas, skelbtas &#225; ";
$locale['DTM_035'] = "Atsakymas paskelbtas";
$locale['DTM_036'] = "Klaida, skelbiant atsakym&#224; ";
$locale['DTM_037'] = "Klaida, skelbiant atsakym&#224;";
$locale['DTM_038'] = "Diskusijø forumas";
$locale['DTM_039'] = "Privat&#251;s prane&#240;imai";
$locale['DTM_040'] = "Privat&#251;s prane&#240;imai: Gaunami";
$locale['DTM_041'] = "Privat&#251;s prane&#240;imai: I&#240;einami";
$locale['DTM_042'] = "Privat&#251;s prane&#240;imai: Archyvas";
$locale['DTM_043'] = "Privat&#251;s prane&#240;imai: Nustatymai";
$locale['DTM_044'] = "Skaityti PM: ";
$locale['DTM_045'] = "Skaityti PM";
$locale['DTM_046'] = "Atsakyti &#225; PM: ";
$locale['DTM_047'] = "Atsakyti &#225; PM";
$locale['DTM_048'] = "Per&#254;i&#251;r&#235;ti PM atsakym&#224;: ";
$locale['DTM_049'] = "Per&#254;i&#251;r&#235;ti PM atsakym&#224;:";
$locale['DTM_050'] = "Nusiøsti PM ";
$locale['DTM_051'] = "Nusiøsti PM";
$locale['DTM_052'] = "Per&#254;i&#251;r&#235;ti PM &#225; ";
$locale['DTM_053'] = "Per&#254;i&#251;r&#235;ti PM";
$locale['DTM_054'] = "Foto galerija";
$locale['DTM_055'] = "Albumas: ";
$locale['DTM_056'] = "Albumas";
$locale['DTM_057'] = "Foto: ";
$locale['DTM_058'] = "Foto";
$locale['DTM_059'] = "Pateikti nuorod&#224;";
$locale['DTM_060'] = "Pateikti naujien&#224;";
$locale['DTM_061'] = "Pateikti straipsn&#225;";
$locale['DTM_062'] = "Registruotis";
$locale['DTM_063'] = "Paie&#240;ka";
$locale['DTM_064'] = "Redaguoti profil&#225;";
$locale['DTM_065'] = "Nariø s&#224;ra&#240;as";
$locale['DTM_066'] = "Pamir&#240;au slapta&#254;od&#225;";
$locale['DTM_067'] = "Kontaktai";
$locale['DTM_068'] = "Sve&#232;iø knyga";

?>[/code]

tada išsaugokite ir įkelkite į locale/Lithuanian/


[color=green]~Enzo[/color]

[i]*Naudotasi keliais šaltinias. Vertimas bei paaiškinimas mano. Visos teisės (tipo) saugomos[/i]