Show Breadcrumb in the content place instead of header
-
loop
- Contributor
- Posts: 253
- Joined: Thu Mar 25, 2021 12:26 pm
- Phoenix Version:
- Has thanked: 7 times
- Been thanked: 3 times
Show Breadcrumb in the content place instead of header
Hi all
I'm trying to display the breadcrumb in the middle (where the content is) and not on top (over Navigation)
Of course I could make a new module for PI so it works in products_info.php but then I would have to make a new module for the "index.php" that makes no sense to make the module multiple times. Is there a way to have it like the header module, but show it in content place?
Thank you!
Philipp
I'm trying to display the breadcrumb in the middle (where the content is) and not on top (over Navigation)
Of course I could make a new module for PI so it works in products_info.php but then I would have to make a new module for the "index.php" that makes no sense to make the module multiple times. Is there a way to have it like the header module, but show it in content place?
Thank you!
Philipp
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: Show Breadcrumb in the content place instead of header
Code: Select all
<?= $hooks->cat('injectBodyContentStart') ?>Code: Select all
class hook_shop_siteWide_breadcrumb {
const EXCLUDES = [];
public function listen_injectBodyContentStart() {
if (!in_array(Request::get_page(), static::EXCLUDES)) {
include $GLOBALS['Template']->map(DIR_FS_CATALOG . 'includes/modules/content/header/cm_header_breadcrumb.php');
}
}
}-
loop
- Contributor
- Posts: 253
- Joined: Thu Mar 25, 2021 12:26 pm
- Phoenix Version:
- Has thanked: 7 times
- Been thanked: 3 times
Re: Show Breadcrumb in the content place instead of header
thank you ecartz!
i get no error, but also don't show the breadcrump in the middle, wenn i put echo "test" in the hook, it shows perfectly in the place i need, but not the content of the header module. Any ideas?
Code: Select all
class hook_shop_siteWide_breadcrump_position {
const EXCLUDES = [];
public function listen_injectBodyContentStart() {
if (!in_array(Request::get_page(), static::EXCLUDES)) {
$tpl_data = [
'group' => 'header',
'file' => DIR_FS_CATALOG . 'includes/modules/header/cm_header_breadcrumb.php',
];
include 'includes/modules/content/cm_template.php';
}
}
}-
loop
- Contributor
- Posts: 253
- Joined: Thu Mar 25, 2021 12:26 pm
- Phoenix Version:
- Has thanked: 7 times
- Been thanked: 3 times
Re: Show Breadcrumb in the content place instead of header
still no output, maybe the "include" does not work in the hook? maybe needs a echo or return?
while investigating, whats in the : include 'includes/modules/content/cm_template.php';
i found out, if i REMOVE ob_get_clean() it works...hmm
so if i make this, i have the output as it should....do you know the reason? should i leave it like this or do you have a solution?
while investigating, whats in the : include 'includes/modules/content/cm_template.php';
i found out, if i REMOVE ob_get_clean() it works...hmm
so if i make this, i have the output as it should....do you know the reason? should i leave it like this or do you have a solution?
Code: Select all
$tpl_data = [
'group' => 'header',
'file' => DIR_FS_CATALOG . 'includes/modules/content/header/cm_header_breadcrumb.php',
];
//include 'includes/modules/content/cm_template.php';
ob_start();
include($GLOBALS['oscTemplate']->map_to_template($tpl_data['file']));
$GLOBALS['oscTemplate']->addContent('', $tpl_data['group']);-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: Show Breadcrumb in the content place instead of header
Just change that whole section of code that you posted to
Code: Select all
include $GLOBALS['Template']->map(DIR_FS_CATALOG . 'includes/modules/content/header/cm_header_breadcrumb.php');-
lecarlb
- Contributor
- Posts: 316
- Joined: Mon Oct 26, 2020 5:26 pm
- Phoenix Version:
- Has thanked: 48 times
- Been thanked: 9 times
Re: Show Breadcrumb in the content place instead of header
@ecartz I would like to move the breadcrumb just below the header or same place as original poster.
I see that you gave code changes but it's confusing. Could you kindly tell what code and in what file that needs to be changed?
Thank you.
I see that you gave code changes but it's confusing. Could you kindly tell what code and in what file that needs to be changed?
Thank you.
- burt
- Core Team
- Posts: 4551
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 412 times
Re: Show Breadcrumb in the content place instead of header
There is an example of a Hooked breadcrumb in the S05E06 Supporters Code;
/templates/gustavo/includes/hooks/shop/siteWide/breadCrumb.php
/templates/gustavo/includes/hooks/shop/siteWide/breadCrumb.php
I am not here to build for you.
I am here to build with you. Let's help each other.
I am here to build with you. Let's help each other.
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: Show Breadcrumb in the content place instead of header
Create
Code: Select all
class hook_shop_siteWide_breadcrumb {
const EXCLUDES = [];
public function listen_injectBodyContentStart() {
if (!in_array(Request::get_page(), static::EXCLUDES)) {
include $GLOBALS['Template']->map(DIR_FS_CATALOG . 'includes/modules/content/header/cm_header_breadcrumb.php');
}
}
}Don't forget to turn the regular module on but set to SCHEMA. If you don't want the schema, then Burt's approach is probably better. Burt's example also doesn't show on the front page but does show on category/product listing pages.