Community @ The Turning Gate

Support community for TTG plugins and products.

NOTICE

The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.

This forum is now closed, and exists here as a read-only archive.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

#1 2020-02-27 23:57:36

pideja
Member
From: Montreal
Registered: 2013-02-26
Posts: 1,299

Breadcrumb behavior

My site is still in development. Today, I am addressing the Breadcrumbs. For the moment, these appear only in the Galleries all through to the single large image as seen here: https://pideja.ca/galleries/03-tnm/sais … 5-laurier/. Works ok, for now.

I'd like to add two new wrinkles. First, I'd like the breadcrumbs to be throughout the site. Using the php code Daniel suggested in a sticky post (Page-specific PHP code), I changed it to reflect the French language used in the site:

/* Breadcrumbs */

function page_match($gallery) {
   if (substr($_SERVER["REQUEST_URI"], 0, strlen($gallery)) == $gallery) {
      return 1;
   }  else {
      return 0;
   }
}

function ttg_crumb( $page_name ) {
	echo '<ul class="breadcrumbs"><li class="fa_pseudo" itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/" itemprop="url"><span itemprop="title">Home</span></a></li><li class="fa_pseudo" itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">'. $page_name .'</span></li></ul>';
}

function main_top(){
	// Add breadcrumbs to non-gallery pages
	if (strtolower($this->slug) == 'accueil') {
		$this->ttg_crumb('Accueil');
	} else if (strtolower($this->slug) == 'contact') {
		$this->ttg_crumb('Contact');
	} else if (strtolower($this->slug) == 'recherche') {
		$this->ttg_crumb('Recherche');
	} else if (strtolower($this->slug) == 'xxxx') {
		$this->ttg_crumb('Xxxx');
	}
}

But, apart from the HOME page displaying in English on the Contact page and twice on...the HOME page, there is no success. Why does the HOME breadcrumb appear twice (as HOME and ACCUEIL) on the Home page?

The other thing I'd like to change is the fact that when I get to the large image, I'd like to have the file name instead of the title displayed in the breadcrumbs. I can change that by omitting to put a title in Lightroom but that just causes me grief for other tasks in Lightroom. Is there a way to use the FILENAME instead of the TITLE for the large image breadcrumb?

Last edited by pideja (2020-02-27 23:57:45)

Offline

#2 2020-02-28 02:15:19

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,624
Website

Re: Breadcrumb behavior

The code is used to create breadcrumbs for user pages and not for the home page. That's why you get Home twice on the home page. Additionally, if you don't want to have it called 'home', you need to change the text in the ttg_crumb line:

function ttg_crumb( $page_name ) {
	echo '<ul class="breadcrumbs"><li class="fa_pseudo" itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/" itemprop="url"><span itemprop="title">Accueil</span></a></li><li class="fa_pseudo" itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">'. $page_name .'</span></li></ul>';
}

function main_top(){
	// Add breadcrumbs to non-gallery pages
	if (strtolower($this->slug) == 'accueil') {
echo '<ul class="breadcrumbs"><li class="fa_pseudo" itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/" itemprop="url"><span itemprop="title">Accueil</span></a></li></ul>';
}	} else if (strtolower($this->slug) == 'contact') {
		$this->ttg_crumb('Contact');
	} else if (strtolower($this->slug) == 'recherche') {
		$this->ttg_crumb('Recherche');
	} else if (strtolower($this->slug) == 'xxxx') {
		$this->ttg_crumb('Xxxx');
	}
}

Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

#3 2020-02-28 02:38:41

pideja
Member
From: Montreal
Registered: 2013-02-26
Posts: 1,299

Re: Breadcrumb behavior

this line caused a problem:

}	} else if (strtolower($this->slug) == 'contact') {

so I changed it to:

	} else if (strtolower($this->slug) == 'contact') {

and it seems to work.
Why no breadcrumbs on the RECHERCHE and GALERIES pages?

All this might be overkill. I'm trying to make it so that when anywhere on the site, one could go to another page without going to the MENU button.

Offline

#4 2020-02-28 02:54:29

pideja
Member
From: Montreal
Registered: 2013-02-26
Posts: 1,299

Re: Breadcrumb behavior

I got the GALERIES breadcrumb to appear, but now I have two!

Considering abandoning this project. All it does is get one back to HOME. If this was a gigantic site (and it might be, someday) I might need this, but for now, I think I'll comment out the php code and save it for later.

Thank you Daniel, sorry to have wasted your time.

Offline

#5 2020-02-28 03:14:41

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,624
Website

Re: Breadcrumb behavior

pideja wrote:

this line caused a problem:

}	} else if (strtolower($this->slug) == 'contact') {

so I changed it to:

	} else if (strtolower($this->slug) == 'contact') {

and it seems to work.

sorry, missed that


Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

Board footer

Powered by FluxBB