Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Create 'current_page_base' for body id where it does not currently exist?

Create 'current_page_base' for body id where it does not currently exist?

Locked

Views: 1,348

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
19 Dec 2007, 6:25 PM
#1
creativearc avatar

creativearc

New Zenner

Join Date:
Feb 2007
Posts:
65
Plugin Contributions:
0

Create 'current_page_base' for body id where it does not currently exist?

I modified tpl_main_page.php to output unique body id tags (for CSS purpose).

The code looks like this:

<body 
<?php 
	if ($this_is_home_page) {
		echo "id=\"Home\"";
	} else if ($current_page_base == "account") {
		echo "id=\"account\""; 
	} else if ($current_page_base == "login") {
(etc etc....)

The order tracker, however, doesn't seem to have a current_page_base (the output is blank for the above function). Is there a way to assign one? Here is the url within my store:

index.php?main_page=tracker&order_id=36

19 Dec 2007, 6:33 PM
#2
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,616
Plugin Contributions:
0

Re: Create 'current_page_base' for body id where it does not currently exist?

The program already creates a unique ID for each page, so I do not quite understand why you would need more, but is this order tracker an add-on?

19 Dec 2007, 6:34 PM
#3
creativearc avatar

creativearc

New Zenner

Join Date:
Feb 2007
Posts:
65
Plugin Contributions:
0

Re: Create 'current_page_base' for body id where it does not currently exist?

Oh, it must be. I found it in 'template_default' so I assumed it was stock. I did indeed install Ty Package Tracker, so that must be it.

If that's the case, how would I add the current_page_base ?

19 Dec 2007, 9:53 PM
#4
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,616
Plugin Contributions:
0

Re: Create 'current_page_base' for body id where it does not currently exist?

Are you doing something with the templates on every page that needs the body ID to be different?

19 Dec 2007, 10:08 PM
#5
creativearc avatar

creativearc

New Zenner

Join Date:
Feb 2007
Posts:
65
Plugin Contributions:
0

Re: Create 'current_page_base' for body id where it does not currently exist?

Kim:

Are you doing something with the templates on every page that needs the body ID to be different?

Yes. I show and hide a navigational element on certain pages.

20 Dec 2007, 9:18 AM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Create 'current_page_base' for body id where it does not currently exist?

There is no need to change core code, unless you've removed functionality from the code.
The ID tag is automatically generated from the page name.

  $body_id = ($this_is_home_page) ? 'indexHome' : str_replace('_', '', $_GET['main_page']);
?>
<body id="<?php echo $body_id . 'Body'; ?>" ...

If your template is missing that logic, then it's based on old code, and needs to be upgraded.

26 Dec 2008, 3:49 AM
#7
dreamlex avatar

dreamlex

New Zenner

Join Date:
Dec 2008
Posts:
57
Plugin Contributions:
0

Re: Create 'current_page_base' for body id where it does not currently exist?

creativearc:

Yes. I show and hide a navigational element on certain pages.

Creativearc, did you manage to do the body ids for every nav item links? I have been looking for the solution..

DrByte, do you know the way to do that?
I do not want "indexBody" for every nav item links. I need body id to apply to certain nav items in order to change colors of the nav item button.

for example I have #home, #cats #dogs etc. then body id="cats" or body id="dogs" etc will change the nav item color and make color stay on till user click on other nav item.

any help would be appreciated.

26 Dec 2008, 5:29 AM
#8
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Create 'current_page_base' for body id where it does not currently exist?

The Smart Backgrounds mod is designed to give unique body class for each top category and each ez-page if desired, as well as other pages. It can be modified for numerous purposes - see its support thread for more info.