Author Topic: [MOD] Cat name in clickstream->to the page# where image i  (Read 62785 times)

0 Members and 1 Guest are viewing this topic.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[MOD] Cat name in clickstream->to the page# where image i
« Reply #15 on: June 11, 2003, 09:22:15 PM »
Quote from: V@no
P.S. not sure why this happend, but sometimes when I enter in details.php, both / cat_name / and / page 2 / have link with &page=2

ok, I figured out when this happend and why:
it happends when I enter in details page from categories.php with page=xx
so, to solve this problem, in my lattest code replace
Code: [Select]
         if (!empty($regs[1]) && $regs[1] != 1) { with:
Code: [Select]
         if (!empty($regs[1]) && $regs[1] != 1 && !$page_details) {
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 Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
[MOD] Cat name in clickstream->to the page# where image i
« Reply #16 on: June 11, 2003, 09:30:34 PM »
Sorry, I'm stuck on something at work and can't do the post now.  I'll try to do it tonight.

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
[MOD] Cat name in clickstream->to the page# where image i
« Reply #17 on: June 12, 2003, 02:12:21 AM »
Okay, here's what I can contribute.

V@no:  The reason sometimes you have $page=2 on category name from details.php is because the variable $url in the function get_category_path() stores the referer URL, not the current URL.  So that affects this line:
Code: [Select]
if (preg_match("/".URL_PAGE."=([0-9]+)/", $url, $regs)) { since the while loop is executing one more time than before the mod (for the page number)

Next post is my complete version of this mod.

P.S.:  You can use print_r to output variable information.  It's a great php built-in function that's useful for testing/debugging.  For example:
Code: [Select]
print_r($regs);might output something like this:
Quote
Array (
  • => page=3 [1] => 3 )

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
[MOD] Cat name in clickstream->to the page# where image i
« Reply #18 on: June 12, 2003, 02:36:44 AM »
Here is the clickstream I set up with this version of the mod.  Note that all bold items would be a clickable link.  When CategoryName is bold, the link would take you to page 1 for that category.

Clickstream from categories.php while on page 1
Home | CategoryName

Clickstream from categories.php while on page 2 or higher
Home | CategoryName | Page 4

Clickstream from details.php when image is on page 1
Home | CategoryName | ImageName

Clickstream from details.php when image is on page 2 or higher
Home | CategoryName | Page 4 | ImageName

 :wink:  Looks like V@no and I took a similar approach with the addition of another parameter for get_category_path()

1.  Open includes/functions.php

1.1 Locate
Code: [Select]
function get_category_path($cat_id = 0, $detail_path = 0)
Replace with:
Code: [Select]
function get_category_path($cat_id = 0, $detail_path = 0, $page = 0, $category_path = 0) {

1.2 Locate:
Code: [Select]
         if (!empty($regs[1]) && $regs[1] != 1) {
            $cat_url .= "&".URL_PAGE."=".$regs[1];
          }

Replace with:
Code: [Select]
         if (!empty($regs[1]) && $regs[1] != 1 && $page == 0) {
            $cat_url .= "&".URL_PAGE."=".$regs[1];
          }

1.3 Locate:
Code: [Select]
 return $path;
Insert before:
Code: [Select]
 if ($page > 1){
    $path .= $config['category_separator'];
    if( $detail_path && !$category_path )
      $path .= "<a href=\"".$site_sess->url($cat_url."&amp;".URL_PAGE."=".$page)."\" class=\"clickstream\">Page ".$page."</a>";
    else
      $path .= "Page ".$page."</a>";
  }


2. Open details.php
Locate:
Code: [Select]
 $clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
Replace with:
Code: [Select]
 $clickstream .= get_category_path($cat_id, 1, $cur_page).$config['category_separator'];

3. Open categories.php
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>";
Replace with:
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, ($page > 1), $page, 1)."</span>";

Note:  This makes clickstream a little inconsistent because lightbox.php has the potential to span multiple pages.  So does member.php.  In fact, I did a quick search and here are the files that use get_category_path()
Quote
$ find . -name "*.php" -print -exec grep get_category_path {} \;
./admin/admin_functions.php
./admin/admin_global.php
./admin/backup.php
./admin/categories.php
./admin/checkimages.php
./admin/comments.php
./admin/email.php
./admin/home.php
./admin/images.php
./admin/index.php
./admin/progress.php
./admin/resizer.php
./admin/settings.php
./admin/stats.php
./admin/templates.php
./admin/thumbnailer.php
./admin/usergroups.php
./admin/users.php
./admin/validateimages.php
./categories.php
$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>";
./config.new.php
./details.php
  $clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
./download.php
./global.php
./includes/auth.php
./includes/constants.php
./includes/db_field_definitions.php
./includes/db_mysql.php
./includes/db_utils.php
./includes/email.php
./includes/functions.php
function get_category_path($cat_id = 0, $detail_path = 0) {
./includes/image_utils.php
./includes/page_footer.php
./includes/page_header.php
./includes/paging.php
./includes/search_utils.php
./includes/sessions.php
./includes/template.php
./includes/upload.php
./includes/upload_definitions.php
./includes/zip.php
./index.php
./install.php
./lang/deutsch/admin.php
./lang/deutsch/install.php
./lang/deutsch/main.php
./lang/english/admin.php
./lang/english/install.php
./lang/english/main.php
./lang/french/admin.php
./lang/french/install.php
./lang/french/main.php
./lang/spanish/admin.php
./lang/spanish/install.php
./lang/spanish/main.php
./lightbox.php
./login.php
./logout.php
./member.php
  $txt_clickstream = get_category_path($comment_row['cat_id'], 1).$config['category_separator']."<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row['image_id'])."\" class=\"clickstream\">".$comment_row['image_name']."</a>".$config['category_separator'];
  $txt_clickstream = get_category_path($comment_row['cat_id'], 1).$config['category_separator']."<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row['image_id'])."\" class=\"clickstream\">".$comment_row['image_name']."</a>".$config['category_separator'];
  $txt_clickstream = get_category_path($comment_row['cat_id'], 1).$config['category_separator']."<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row['image_id'])."\" class=\"clickstream\">".$comment_row['image_name']."</a>".$config['category_separator'];
  $txt_clickstream = get_category_path($comment_row['cat_id'], 1).$config['category_separator']."<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row['image_id'])."\" class=\"clickstream\">".$comment_row['image_name']."</a>".$config['category_separator'];
  $txt_clickstream = get_category_path($image_row['cat_id'], 1).$config['category_separator']."<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\" class=\"clickstream\">".$image_row['image_name']."</a>".$config['category_separator'];
  $txt_clickstream = get_category_path($image_row['cat_id'], 1).$config['category_separator']."<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\" class=\"clickstream\">".$image_row['image_name']."</a>".$config['category_separator'];
  $txt_clickstream = get_category_path($image_row['cat_id'], 1).$config['category_separator']."<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\" class=\"clickstream\">".$image_row['image_name']."</a>".$config['category_separator'];
    $txt_clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
    $txt_clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
./phpinfo.php
./postcards.php
  $clickstream .= get_category_path($cat_id, 1).$config['category_separator']."<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\" class=\"clickstream\">".$image_row['image_name']."</a>".$config['category_separator'];
./register.php
./search.php
./top.php
  $clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
./config.php

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[MOD] Cat name in clickstream->to the page# where image i
« Reply #19 on: June 12, 2003, 02:47:51 AM »
very nice, Chris!
but I didnt get this part:
Quote from: Chris
Note:  This makes clickstream a little inconsistent because lightbox.php has the potential to span multiple pages.  So does member.php.

what were u talking about?
what lightbox has with get_category_path() ?
all it add in clickstream is name "lighbox" that's all...
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 Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
[MOD] Cat name in clickstream->to the page# where image i
« Reply #20 on: June 12, 2003, 02:53:45 AM »
Exactly my point.  If you have 3 pages of images stored in your lightbox and you click on an image from page 2, you only get:

Home | Light Box

and there's no easy way to get:

Home | Light Box | Page 2

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[MOD] Cat name in clickstream->to the page# where image i
« Reply #21 on: June 12, 2003, 03:02:53 AM »
Quote from: Chris
Exactly my point.  If you have 3 pages of images stored in your lightbox and you click on an image from page 2, you only get:

Home | Light Box

and there's no easy way to get:

Home | Light Box | Page 2
ah oh uh now I got it...
and u are right, its not easy to do...
« Last Edit: March 09, 2005, 03:07:29 AM by Chris »
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 effemmess

  • Sr. Member
  • ****
  • Posts: 304
    • View Profile
[MOD] Cat name in clickstream->to the page# where image i
« Reply #22 on: June 12, 2003, 04:46:12 AM »
Hi ladies and gentlemen,

do I have an addon for the addon of the addon to the addon ... ???
Yes!!! :D

But first my version of our function:
Code: [Select]
function get_category_path($cat_id = 0, $detail_path = 0, $page = 0, $page_details = 0) { // V3 by effemmess
  global $site_sess, $config, $cat_cache, $url, $lang;
  $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;

/* imo we do not need this, because we do later our own page-handling...        
           if (preg_match("/".URL_PAGE."=([0-9]+)/", $url, $regs)) {
             printf($regs[1]."<br />");
             if (!empty($regs[1]) && $regs[1] != 1 && !$page_details) {
               $cat_url .= "&amp;".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
  $pagereg  = "&amp;".URL_PAGE."=".$page;
  $page     = ($page_details) ? "<a href=\"".$site_sess->url($cat_url.$pagereg)."\" class=\"clickstream\">".$lang['page']." ".$page."</a>" : $lang['page']." ".$page;
  $path     = $path.$config['category_separator'].$page;
  return $path;
}


clickstream in categories.php:
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, 1, $page)."</span>";

clickstream in details.php:
Code: [Select]
 $clickstream .= get_category_path($cat_id, 1, $cur_page, 1).$config['category_separator'];

It produces following:

Clickstream from categories.php while on page 1
Home | CategoryName | Page 1

Clickstream from categories.php while on page 2 or higher
Home | CategoryName | Page 4

Clickstream from details.php when image is on page 1
Home | CategoryName | Page 1 | ImageName

Clickstream from details.php when image is on page 2 or higher
Home | CategoryName | Page 4 | ImageName

Note that all bold items are clickable, the categorie-items are links to page 1.

Imo this is the best solution...what do you think. :roll:
@Xwall
How do you feel now?  :D

And now:
In all other php-files with paging you can do following:
before $clickstream="..." add
Code: [Select]
$page= (empty($page)) ? 1 :$page;

and edit the clickstream-row!
for example in lightbox.php:
Code: [Select]
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];
$clickstream.= "<a href=\"".$site_sess->url(ROOT_PATH."lightbox.php")."\" class=\"clickstream\">".$lang['lightbox']."</a>".$config['category_separator'];
$clickstream.= $lang['page']." ".$page."</span>";


cu and good night...mhhh only 2,5 h to sleep... :(  
effemmess

PS: you can show, how it looks at: http://www.auf-einem-blick.de
bye

Offline pietg

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
    • http://www.totaaldigitaal.nl
Re: Extra Link to Subcat on Detail Page
« Reply #23 on: June 14, 2003, 11:50:15 PM »
Quote from: rpiatti
Thank you V@no this is very usefull Mod!
Is it possible to have an extra link on the detail Page which brings you directly to the page where the thumbnail image is. This would be some kind of an extract from the clickstream on the detail Page.
Example
Clickstream:  Home / cat name / subcat name / image name
Extra Link to: subcat name

From me the same question.
But I would like to have the link "hidden" under a button (picture).



Piet

Offline TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Re: [MOD] Cat name in clickstream->to the page# where image i
« Reply #24 on: October 22, 2005, 09:00:55 AM »
Quote
Is it possible to have an extra link on the detail Page which brings you directly to the page where the thumbnail image is. This would be some kind of an extract from the clickstream on the detail Page.
Example
Clickstream:  Home / cat name / subcat name / image name
Extra Link to: subcat name

I have the same need. Can anybody help me?

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: [MOD] Cat name in clickstream->to the page# where image i
« Reply #25 on: January 15, 2006, 01:14:24 PM »
And now:
In all other php-files with paging you can do following:
before $clickstream="..." add
Code: [Select]
$page= (empty($page)) ? 1 :$page;
and edit the clickstream-row!
for example in lightbox.php:
Code: [Select]
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];
$clickstream.= "<a href=\"".$site_sess->url(ROOT_PATH."lightbox.php")."\" class=\"clickstream\">".$lang['lightbox']."</a>".$config['category_separator'];
$clickstream.= $lang['page']." ".$page."</span>";

I have install the Multi Lightbox Box. What must i change to have this function in lightbox (see on which site i am)???

The Original from the Multi Lightbox Mod

Quote
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
}
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$txt_clickstream."</span>";
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline Lunique

  • Full Member
  • ***
  • Posts: 109
  • V 1.7.7
    • View Profile
Re: Extra Link to Subcat on Detail Page
« Reply #26 on: May 19, 2006, 09:26:11 PM »
Quote from: rpiatti
Thank you V@no this is very usefull Mod!
Is it possible to have an extra link on the detail Page which brings you directly to the page where the thumbnail image is. This would be some kind of an extract from the clickstream on the detail Page.
Example
Clickstream:  Home / cat name / subcat name / image name
Extra Link to: subcat name

I need the same, or only the extra link. Is this possible?

editet: I found what I need here: http://www.4homepages.de/forum/index.php?topic=2683.msg70658#msg70658
« Last Edit: June 22, 2006, 02:42:21 PM by Lunique »

Offline MetallicAchu

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: [MOD] Cat name in clickstream->to the page# where image i
« Reply #27 on: May 21, 2006, 01:55:20 AM »
Excellent!

Exactly what I was looking for.

Offline MetallicAchu

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: [MOD] Cat name in clickstream->to the page# where image i
« Reply #28 on: May 21, 2006, 07:39:47 AM »
BTW, I noticed that this feature doesn't really work on searched pictures.
Eg. if search for something (or press the "new images" for say) and you detail an image, this mod will take you back to the start, not the page you were in. :)

Any thoughts on that?

Offline bunelul

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: [MOD] Cat name in clickstream->to the page# where image i
« Reply #29 on: June 21, 2006, 08:09:15 AM »


Ok, i installed this mod but now i have this url-s from clickstrean: categories.php?cat_id=19&page=4&page=4 and can`t figure out what is wrong...
Could somebody enlight me?

Thanks.