• [MOD] Dynamic Page Title for v1.7 & v1.7.1 5 0 5 1
Currently:  

Author Topic: [MOD] Dynamic Page Title for v1.7 & v1.7.1  (Read 269275 times)

0 Members and 1 Guest are viewing this topic.

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
[MOD] Dynamic Page Title for v1.7 & v1.7.1
« on: March 11, 2005, 03:20:04 PM »
This mod outputs a dynamic (ever changing) page title for your web pages. Essentially this adds the clickstream to your page title but without the added HTML markup.

If your site name is defined as "Smith Family Pictures" and you were viewing a details.php page for an image named "Old Bridge" in a subcategory named "Road Trip" which was a subcategory of a top-level "2005 Events" category and your admin control panel setting for "Category delimiter (in category paths)" was defined as "/", your page title would look like this: Smith Family Pictures /2005 Events/Road Trip/Old Bridge

As with any mod, ALWAYS save backup copies of any file you might edit so you can go back to a clean, working version if you encounter any problems.

Open includes/functions.php, locate:
Code: [Select]
function get_category_path($cat_id = 0, $detail_path = 0) {
  global $site_sess, $config, $cat_cache, $url;
  $parent_id = 1;
  while ($parent_id) {
    if (!isset($cat_cache[$cat_id]['cat_parent_id'])) {
      return false;
    }
    $parent_id = $cat_cache[$cat_id]['cat_parent_id'];

    if (empty($path)) {
      if ($detail_path) {
        $cat_url = ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id;
        if (preg_match("/".URL_PAGE."=([0-9]+)/", $url, $regs)) {
          if (!empty($regs[1]) && $regs[1] != 1) {
            $cat_url .= "&".URL_PAGE."=".$regs[1];
          }
        }
        $path = "<a href=\"".$site_sess->url($cat_url)."\" class=\"clickstream\">".$cat_cache[$cat_id]['cat_name']."</a>";
      }
      else  {
        $path = $cat_cache[$cat_id]['cat_name'];
      }
    }
    else {
      $path = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id)."\" class=\"clickstream\">".$cat_cache[$cat_id]['cat_name']."</a>".$config['category_separator'].$path;
    }
    $cat_id = $parent_id;
  } // end while
  return $path;
}

Add after:
Code: [Select]

function get_category_path_nohtml($cat_id = 0) {  // MOD: Dynamic page title
  global $config, $cat_cache;
  $parent_id = 1;
  while ($parent_id) {
    if (!isset($cat_cache[$cat_id]['cat_parent_id'])) {
      return false;
    }
    $parent_id = $cat_cache[$cat_id]['cat_parent_id'];

    if (empty($path)) {
      $path = $cat_cache[$cat_id]['cat_name'];
    }
    else {
      $path = $cat_cache[$cat_id]['cat_name'].$config['category_separator'].$path;
    }
    $cat_id = $parent_id;
  } // end while
  return $path;
}



Open categories.php, locate:
Code: [Select]
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].get_category_path($cat_id)."</span>";
Add after:
Code: [Select]
$page_title = $config['category_separator'].get_category_path_nohtml($cat_id); // MOD: Dynamic page title
Locate:
Code: [Select]
$site_template->register_vars(array(
  "msg" => $msg,
  "clickstream" => $clickstream
));

Change to:
Code: [Select]
$site_template->register_vars(array(
  "msg" => $msg,
  "clickstream" => $clickstream,
  "page_title" => $page_title // MOD: Dynamic page title
));



Open details.php, locate:
Code: [Select]
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];
Add after:
Code: [Select]
$page_title = $config['category_separator'].$lang['home'].$config['category_separator']; // MOD: Dynamic page title
Locate:
Code: [Select]
  $clickstream .= "<a href=\"".$site_sess->url(ROOT_PATH."lightbox.php".$page_url)."\" class=\"clickstream\">".$lang['lightbox']."</a>".$config['category_separator'];
Add after:
Code: [Select]
  $page_title = $config['category_separator'].$lang['lightbox'].$config['category_separator']; // MOD: Dynamic page title
Locate:
Code: [Select]
  $clickstream .= "<a href=\"".$site_sess->url(ROOT_PATH."search.php?show_result=1".$page_url)."\" class=\"clickstream\">".$lang['search']."</a>".$config['category_separator'];
Add after:
Code: [Select]
  $page_title = $config['category_separator'].$lang['search'].$config['category_separator']; // MOD: Dynamic page title
Locate:
Code: [Select]
  $clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
Add after:
Code: [Select]
  $page_title = $config['category_separator'].get_category_path_nohtml($cat_id).$config['category_separator']; // MOD: Dynamic page title
Locate:
Code: [Select]
$clickstream .= $image_name."</span>";
Add after:
Code: [Select]
$page_title .= $image_name; // MOD: Dynamic page title
Locate:
Code: [Select]
$site_template->register_vars(array(
  "msg" => $msg,
  "clickstream" => $clickstream,

CHANGE to:
Code: [Select]
$site_template->register_vars(array(
  "msg" => $msg,
  "clickstream" => $clickstream,
  "page_title" => $page_title, // MOD: Dynamic page title



Open index.php, locate:
Code: [Select]
if (!empty($template)) {
  $clickstream = "<a href=\"".$site_sess->url(ROOT_PATH."index.php")."\">".$lang['home']."</a>".$config['category_separator'].str_replace("_", " ", ucfirst($template));

Add after:
Code: [Select]
  $page_title = $config['category_separator'].str_replace("_", " ", ucfirst($template)); // MOD: Dynamic page title
Locate:
Code: [Select]
  $site_template->register_vars("clickstream", $clickstream);
CHANGE to:
Code: [Select]
  $site_template->register_vars(array(
    "clickstream" => $clickstream,
    "page_title" => $page_title // MOD: Dynamic page title
  ));

On the next line down, locate:
Code: [Select]
  $site_template->print_template($site_template->parse_template($main_template));
  include(ROOT_PATH.'includes/page_footer.php');
}

CHANGE this to:
Code: [Select]
  $site_template->print_template($site_template->parse_template($main_template));
  include(ROOT_PATH.'includes/page_footer.php');
} else { // MOD: Dynamic page title
  $page_title = $config['category_separator'].$lang['home'];
  $site_template->register_vars("page_title", $page_title);
}

Locate:
Code: [Select]
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  "msg" => $msg,
  "clickstream" => $clickstream
));

CHANGE this to:
Code: [Select]
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  "msg" => $msg,
  "clickstream" => $clickstream,
  "page_title" => $page_title // MOD: Dynamic page title
));



Open lightbox.php, locate:
Code: [Select]
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$lang['lightbox']."</span>";

Add after:
Code: [Select]
$page_title = $config['category_separator'].$lang['lightbox']; // MOD: Dynamic page title
Locate:
Code: [Select]
$site_template->register_vars(array(
  "msg" => $msg,
  "clickstream" => $clickstream,

CHANGE this to:
Code: [Select]
$site_template->register_vars(array(
  "msg" => $msg,
  "clickstream" => $clickstream,
  "page_title" => $page_title, // MOD: Dynamic page title



Open member.php, locate:
Code: [Select]
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$txt_clickstream."</span>";

Add after:
Code: [Select]
$page_title = $config['category_separator'].$txt_clickstream; // MOD: Dynamic page title
Locate:
Code: [Select]
$site_template->register_vars(array(
  "content" => $content,
  "msg" => $msg,
  "clickstream" => $clickstream,

CHANGE this to:
Code: [Select]
$site_template->register_vars(array(
  "content" => $content,
  "msg" => $msg,
  "clickstream" => $clickstream,
  "page_title" => $page_title, // MOD: Dynamic page title



Open register.php, locate:
Code: [Select]
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$lang['register']."</span>";

Add after:
Code: [Select]
$page_title = $config['category_separator'].$lang['register']; // MOD: Dynamic page title
Locate:
Code: [Select]
$site_template->register_vars(array(
  "content" => $content,
  "msg" => $msg,
  "clickstream" => $clickstream,

CHANGE this to:
Code: [Select]
$site_template->register_vars(array(
  "content" => $content,
  "msg" => $msg,
  "clickstream" => $clickstream,
  "page_title" => $page_title, // MOD: Dynamic page title



Open search.php, locate:
Code: [Select]
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$lang['search']."</span>";

CHANGE this to:
Code: [Select]
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
// $clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$lang['search']."</span>"; // Original code
// MOD: Dynamic page title BLOCK BEGIN
if (!empty($search_id['search_new_images'])) {
  if( $search_id['search_new_images'] == 1 )
    $txt_clickstream = $lang['new_images'];
  else
    $txt_clickstream = $lang['new_images_since'];
}
else {
  $txt_clickstream = $lang['search'];
}
$clickstream = "<span class=\"clickstream\"><a title=\"".$lang['home']."\" href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].(($search_keywords) ? "<a href=\"".$site_sess->url(ROOT_PATH."search.php")."\" class=\"clickstream\">".$lang['search']."</a>".$config['category_separator'].$search_keywords : $txt_clickstream)."</span>";  // Show search keywords
$page_title = $config['category_separator'].$txt_clickstream;
// MOD: Dynamic page title BLOCK END

Locate:
Code: [Select]
$site_template->register_vars(array(
  "content" => $content,
  "msg" => $msg,
  "clickstream" => $clickstream,

CHANGE this to:
Code: [Select]
$site_template->register_vars(array(
  "content" => $content,
  "msg" => $msg,
  "clickstream" => $clickstream,
  "page_title" => $page_title, // MOD: Dynamic page title



Open top.php, locate:
Code: [Select]
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];
if ($cat_id && isset($cat_cache[$cat_id])) {
  $clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
}
$clickstream .= $lang['top_images']."</span>";

CHANGE this to:
Code: [Select]
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a title=\"".$lang['home']."\" href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];
$page_title = $config['category_separator']; // MOD: Dynamic page title
if ($cat_id && isset($cat_cache[$cat_id])) {
  $clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
  $page_title .= get_category_path_nohtml($cat_id).$config['category_separator']; // MOD: Dynamic page title
}
$clickstream .= $lang['top_images']."</span>";
$page_title .= $lang['top_images']; // MOD: Dynamic page title

Locate:
Code: [Select]
$site_template->register_vars(array(
  "msg" => $msg,
  "clickstream" => $clickstream,

CHANGE this to:
Code: [Select]
$site_template->register_vars(array(
  "msg" => $msg,
  "clickstream" => $clickstream,
  "page_title" => $page_title, // MOD: Dynamic page title



Open templates/default/header.html, locate:
Code: [Select]
<title>{site_name}</title>
CHANGE this to:
Code: [Select]
<title>{site_name} {page_title}</title>


IF you are using version 1.7, you are finished STOP HERE




IF you are using version 1.7.1 which has a new template processing engine, you will also need to do the following steps:


Open includes/functions.php, locate:
Code: [Select]
function show_error_page($error_msg, $clickstream = "") {
  global $site_template, $site_sess, $lang, $config;
  if (empty($clickstream)) {
    $clickstream = "<a href=\"".$site_sess->url(ROOT_PATH."index.php")."\">".$lang['home']."</a>".$config['category_separator'].$lang['error'];
  }
  $site_template->register_vars(array(
    "error_msg" => $error_msg,
    "lang_error" => $lang['error'],
    "clickstream" => $clickstream,
    "random_image" => ""
  ));
  $site_template->print_template($site_template->parse_template("error"));
  exit;
}

Change this to:
Code: [Select]
function show_error_page($error_msg, $clickstream = "") {
  global $site_template, $site_sess, $lang, $config;
  if (empty($clickstream)) {
    $clickstream = "<a href=\"".$site_sess->url(ROOT_PATH."index.php")."\">".$lang['home']."</a>".$config['category_separator'].$lang['error'];
  }
  $site_template->register_vars(array(
    "error_msg" => $error_msg,
    "lang_error" => $lang['error'],
    "clickstream" => $clickstream,
    "random_image" => ""
  ));
  // MOD: Dynamic page title BLOCK BEGIN
  $header = $site_template->parse_template("header");
  $footer = $site_template->parse_template("footer");
  $site_template->register_vars(array(
    "header" => $header,
    "footer" => $footer
  ));
  unset($header);
  unset($footer);
  // MOD: Dynamic page title BLOCK END
  $site_template->print_template($site_template->parse_template("error"));
  exit;
}

Open includes/page_header.php, locate:
Code: [Select]
//-----------------------------------------------------
//--- Parse Header & Footer ---------------------------
//-----------------------------------------------------
if (isset($main_template) && $main_template) {
  $header = $site_template->parse_template("header");
  $footer = $site_template->parse_template("footer");
  $site_template->register_vars(array(
    "header" => $header,
    "footer" => $footer
  ));
  unset($header);
  unset($footer);
}

We need to move this logic to each of the top-level php files, so comment out this code by replacing it with:
Code: [Select]
/********** ORIGINAL
//-----------------------------------------------------
//--- Parse Header & Footer ---------------------------
//-----------------------------------------------------
if (isset($main_template) && $main_template) {
  $header = $site_template->parse_template("header");
  $footer = $site_template->parse_template("footer");
  $site_template->register_vars(array(
    "header" => $header,
    "footer" => $footer
  ));
  unset($header);
  unset($footer);
}
**********/

Open categories.php, details.php, index.php, lightbox.php, member.php, postcards.php, register.php, search.php, top.php and locate this line:
Code: [Select]
$site_template->print_template($site_template->parse_template($main_template));
On a new line ABOVE that line, paste this
Code: [Select]
// MOD: Dynamic page title BLOCK BEGIN
//-----------------------------------------------------
//--- Parse Header & Footer ---------------------------
//-----------------------------------------------------
if (isset($main_template) && $main_template) {
  $header = $site_template->parse_template("header");
  $footer = $site_template->parse_template("footer");
  $site_template->register_vars(array(
    "header" => $header,
    "footer" => $footer
  ));
  unset($header);
  unset($footer);
}
// MOD: Dynamic page title BLOCK END

NOTE: There are TWO places inside index.php this needs to be done. All the other PHP files listed above have only ONE.

Revision History:
* Bug fix in includes/functions.php show_error_page() for version 1.7.1
* Added support for version 1.7.1. I do not like the solution as it is a hack but it works.
* Corrected a typo in the edit needed for categories.php

Offline marod0er

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: [MOD] Dynamic Page Title for v1.7 & v1.7.1
« Reply #1 on: March 15, 2005, 04:00:06 PM »
Hi,

Great mod, I badly need this. But I need it the other way around, like this:

Old Bridge / Road Trip / 2005 Events / Smith Family Pictures

-Because you see, this way the individual page is going to be ranked higher in search engines, and isn't that what we all want? :D

Thanks, keep me/us posted!!!
Greetz: Lasse

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Re: [MOD] Dynamic Page Title for v1.7 & v1.7.1
« Reply #2 on: March 15, 2005, 04:40:23 PM »
This was SO already covered before the hacker attack...  :roll:

Try using MSN or Yahoo to search the 4homepages.de site for "Dynamic Page Title for v1.7 & v1.7.1".  You will find the answer in the search engine's cached pages.  I just don't have time to do it right now.

Offline Tusnelda99

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: [MOD] Dynamic Page Title for v1.7 & v1.7.1
« Reply #3 on: March 22, 2005, 11:52:49 AM »
@ Chris,

could it be, that you forgot something??

because in the second describtion (of your posting) for Version 1.7.1 you told us, to edit ..., postcards.php, ... but this file we donīt change in the first part??? but all others?? is this correct??

sorry for my bad english, i hope you understood my problem?

cu Tusnelda

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Re: [MOD] Dynamic Page Title for v1.7 & v1.7.1
« Reply #4 on: March 22, 2005, 06:36:55 PM »
If you are using 1.7.1 you must follow ALL instructions in BOTH parts

Offline Tusnelda99

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: [MOD] Dynamic Page Title for v1.7 & v1.7.1
« Reply #5 on: March 22, 2005, 07:51:49 PM »
If you are using 1.7.1 you must follow ALL instructions in BOTH parts

Thatīs logical!! but in the first part you donīt make any change in the postcards.php for example at the clickstream, ... and my question now is, is this correct??? because when i will made a postcard i donīt have the "clickstream" in the title!!! as i have in the other pages?!!

cu Tusnelda

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Dynamic Page Title for v1.7 & v1.7.1
« Reply #6 on: March 23, 2005, 12:49:35 AM »
actualy I think in either of versions u'll get title in postcard.php ;)
but if u look closely on the changes in other files, its not that difficult to figure out what should be done to postcards.php ;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Tusnelda99

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: [MOD] Dynamic Page Title for v1.7 & v1.7.1
« Reply #7 on: March 23, 2005, 02:33:24 PM »
@ Vano  :wink:

yes thanks iīve done this changes and now it works very fine!! Thank you!!

But i have a nother Question to the Page Title,
my counter uses his own page title an now i would give the code from this mod to the counter.

But when i include it which is in the install.txt it doesnīt work?! ***Help***
This is the code:

Include in page_header.php this code:

ob_start();
$chCounter_visible = 0;
$chCounter_status = 'active';
$chCounter_page_title = $page_title;
include( 'path to counter/counter.php' );
$chCounter = ob_get_contents();
ob_end_clean();

I change the page title from PictureGallery to $page_title but it didnīt work.

Did anybody have an idea which i could solve this problem?

Big Thanks Tusnelda

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Dynamic Page Title for v1.7 & v1.7.1
« Reply #8 on: March 23, 2005, 11:53:34 PM »
$page_title variable is being set at the end of each file, page_header.php being included at the beginning...so, your best bet is enter that code in every "main" .php file :?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline abdoh2010

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • Racing 4 Education
Re: [MOD] Dynamic Page Title for v1.7 & v1.7.1
« Reply #9 on: March 24, 2005, 07:09:32 AM »
i so this mod before in the help fourm i think by Jan but let me tel you this chris :D

you are bring the life agian in 4images mod by your work

you can review jan add by searching for clickstream2

Offline bentleykf

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: [MOD] Dynamic Page Title for v1.7 & v1.7.1
« Reply #10 on: March 27, 2005, 12:46:13 PM »
I know its a minor thing but it is probably better for search engines if titles are formatted like this;

Page Title - Site Name

instead of what this mod currently does

Site Name - Page Title

with images, the image title should appear first, then the category, then the site name, so it is easier for searchers to browse through, and search engines identify a search string at the start of the title, rather than at the end.

-bents

Offline bentleykf

  • Newbie
  • *
  • Posts: 12
    • View Profile
[MOD-MOD] Dynamic Page Title for v1.7 & v1.7.1
« Reply #11 on: March 27, 2005, 01:21:25 PM »
I've already done the mod, so i'll write a mod-mod for you.   Below is a modification of the "Dynamic Page Title for v1.7 & v1.7.1 modification of 4images".  Good luck modding!



Open categories.php, locate:
Code: [Select]
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].get_category_path($cat_id)."</span>";
$page_title = $config['category_separator'].get_category_path_nohtml($cat_id); // MOD: Dynamic page title

change to:
Code: [Select]
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].get_category_path($cat_id)."</span>";
$page_title = get_category_path_nohtml($cat_id).$config['category_separator']; // MOD: Dynamic page title




Open details.php, locate:
Code: [Select]
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];
$page_title = $config['category_separator'].$lang['home'].$config['category_separator']; // MOD: Dynamic page title

change to:
Code: [Select]
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];
$page_title = $lang['home'].$config['category_separator']; // MOD: Dynamic page title

locate:
Code: [Select]
  $clickstream .= "<a href=\"".$site_sess->url(ROOT_PATH."lightbox.php".$page_url)."\" class=\"clickstream\">".$lang['lightbox']."</a>".$config['category_separator'];
  $page_title = $config['category_separator'].$lang['lightbox'].$config['category_separator']; // MOD: Dynamic page title

change to:
Code: [Select]
  $clickstream .= "<a href=\"".$site_sess->url(ROOT_PATH."lightbox.php".$page_url)."\" class=\"clickstream\">".$lang['lightbox']."</a>".$config['category_separator'];
  $page_title = $lang['lightbox'].$config['category_separator'] . $page_title; // MOD: Dynamic page title

locate:
Code: [Select]
  $clickstream .= "<a href=\"".$site_sess->url(ROOT_PATH."search.php?show_result=1".$page_url)."\" class=\"clickstream\">".$lang['search']."</a>".$config['category_separator'];
  $page_title = $config['category_separator'].$lang['search'].$config['category_separator']; // MOD: Dynamic page title

change to:
Code: [Select]
  $clickstream .= "<a href=\"".$site_sess->url(ROOT_PATH."search.php?show_result=1".$page_url)."\" class=\"clickstream\">".$lang['search']."</a>".$config['category_separator'];
  $page_title = $lang['search'].$config['category_separator'] . $page_title; // MOD: Dynamic page title

locate:
Code: [Select]
  $clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
  $page_title = $config['category_separator'].get_category_path_nohtml($cat_id).$config['category_separator']; // MOD: Dynamic page title

change to:
Code: [Select]
  $clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
  $page_title = get_category_path_nohtml($cat_id).$config['category_separator'] . $page_title; // MOD: Dynamic page title

locate:
Code: [Select]
$clickstream .= $image_name."</span>";
$page_title .= $image_name; // MOD: Dynamic page title

change to:
Code: [Select]
$clickstream .= $image_name."</span>";
$page_title = $image_name.$config['category_separator'] . $page_title; // MOD: Dynamic page title




Open index.php, locate:
Code: [Select]
if (!empty($template)) {
  $clickstream = "<a href=\"".$site_sess->url(ROOT_PATH."index.php")."\">".$lang['home']."</a>".$config['category_separator'].str_replace("_", " ", ucfirst($template));
  $page_title = $config['category_separator'].str_replace("_", " ", ucfirst($template)); // MOD: Dynamic page title

change to:
Code: [Select]
if (!empty($template)) {
  $clickstream = "<a href=\"".$site_sess->url(ROOT_PATH."index.php")."\">".$lang['home']."</a>".$config['category_separator'].str_replace("_", " ", ucfirst($template));
  $page_title = str_replace("_", " ", ucfirst($template)).$config['category_separator']; // MOD: Dynamic page title

locate:
Code: [Select]
  $site_template->print_template($site_template->parse_template($main_template));
  include(ROOT_PATH.'includes/page_footer.php');
} else { // MOD: Dynamic page title
  $page_title = $config['category_separator'].$lang['home'];
  $site_template->register_vars("page_title", $page_title);
}

change to:
Code: [Select]
  $site_template->print_template($site_template->parse_template($main_template));
  include(ROOT_PATH.'includes/page_footer.php');
} else { // MOD: Dynamic page title
  $page_title = $lang['home'].$config['category_separator'];
  $site_template->register_vars("page_title", $page_title);
}




Open lightbox.php, locate:
Code: [Select]
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$lang['lightbox']."</span>";
$page_title = $config['category_separator'].$lang['lightbox']; // MOD: Dynamic page title

change to:
Code: [Select]
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$lang['lightbox']."</span>";
$page_title = $lang['lightbox'].$config['category_separator']; // MOD: Dynamic page title




Open member.php, locate:
Code: [Select]
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$txt_clickstream."</span>";
$page_title = $config['category_separator'].$txt_clickstream; // MOD: Dynamic page title

change to:
Code: [Select]
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$txt_clickstream."</span>";
$page_title = $txt_clickstream.$config['category_separator']; // MOD: Dynamic page title




Open register.php, locate:
Code: [Select]
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$lang['register']."</span>";
$page_title = $config['category_separator'].$lang['register']; // MOD: Dynamic page title

change to:
Code: [Select]
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$lang['register']."</span>";
$page_title = $lang['register'].$config['category_separator']; // MOD: Dynamic page title




Open search.php, locate:
Code: [Select]
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
// $clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$lang['search']."</span>"; // Original code
// MOD: Dynamic page title BLOCK BEGIN
if (!empty($search_id['search_new_images'])) {
  if( $search_id['search_new_images'] == 1 )
    $txt_clickstream = $lang['new_images'];
  else
    $txt_clickstream = $lang['new_images_since'];
}
else {
  $txt_clickstream = $lang['search'];
}
$clickstream = "<span class=\"clickstream\"><a title=\"".$lang['home']."\" href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].(($search_keywords) ? "<a href=\"".$site_sess->url(ROOT_PATH."search.php")."\" class=\"clickstream\">".$lang['search']."</a>".$config['category_separator'].$search_keywords : $txt_clickstream)."</span>";  // Show search keywords
$page_title = $config['category_separator'].$txt_clickstream;
// MOD: Dynamic page title BLOCK END

change to:
Code: [Select]
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
// $clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$lang['search']."</span>"; // Original code
// MOD: Dynamic page title BLOCK BEGIN
if (!empty($search_id['search_new_images'])) {
  if( $search_id['search_new_images'] == 1 )
    $txt_clickstream = $lang['new_images'];
  else
    $txt_clickstream = $lang['new_images_since'];
}
else {
  $txt_clickstream = $lang['search'];
}
$clickstream = "<span class=\"clickstream\"><a title=\"".$lang['home']."\" href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].(($search_keywords) ? "<a href=\"".$site_sess->url(ROOT_PATH."search.php")."\" class=\"clickstream\">".$lang['search']."</a>".$config['category_separator'].$search_keywords : $txt_clickstream)."</span>";  // Show search keywords
$page_title = $txt_clickstream.$config['category_separator'];
// MOD: Dynamic page title BLOCK END




Open top.php, locate:
Code: [Select]
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a title=\"".$lang['home']."\" href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];
$page_title = $config['category_separator']; // MOD: Dynamic page title
if ($cat_id && isset($cat_cache[$cat_id])) {
  $clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
  $page_title .= get_category_path_nohtml($cat_id).$config['category_separator']; // MOD: Dynamic page title
}
$clickstream .= $lang['top_images']."</span>";
$page_title .= $lang['top_images']; // MOD: Dynamic page title

change to:
Code: [Select]
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a title=\"".$lang['home']."\" href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];
if ($cat_id && isset($cat_cache[$cat_id])) {
  $clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
  $page_title = get_category_path_nohtml($cat_id).$config['category_separator']; // MOD: Dynamic page title
}
$clickstream .= $lang['top_images']."</span>";
$page_title .= $lang['top_images']; // MOD: Dynamic page title
$page_title .= $config['category_separator']; // MOD: Dynamic page title




Open templates/default/header.html, locate:
Code: [Select]
<title>{site_name} {page_title}</title>
change to:
Code: [Select]
<title>{page_title} {site_name}</title>

This should work, good luck!!!


-bents

Offline bentleykf

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: [MOD] Dynamic Page Title for v1.7 & v1.7.1
« Reply #12 on: April 14, 2005, 04:05:10 PM »
NOTE: By placing the parsing of the header and footer to the very end of every file, the show_error_page() function does not show the header and footer data when an error occurs.  The show_error_page function expects that the header and footer has been parsed before it has been called.

-bents

Offline abda53bd

  • Sr. Member
  • ****
  • Posts: 484
    • View Profile
Re: [MOD] Dynamic Page Title for v1.7 & v1.7.1
« Reply #13 on: April 15, 2005, 12:45:37 AM »
NOTE: By placing the parsing of the header and footer to the very end of every file, the show_error_page() function does not show the header and footer data when an error occurs.  The show_error_page function expects that the header and footer has been parsed before it has been called.

-bents

i just saw this with the login page with a wrong password

how can we correct this?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Dynamic Page Title for v1.7 & v1.7.1
« Reply #14 on: April 15, 2005, 12:52:36 AM »
u could try add
Code: [Select]
  include(ROOT_PATH.'includes/page_header.php'); at the begining of the function and
Code: [Select]
  include(ROOT_PATH.'includes/page_footer.php'); at the end (above exit;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)