Hello, I can't seem to figure out how to write an if statement in page.tpl.php that checks to see if the title is generated from ubercart or not. Would it be to check if it's a taxonomy term but if so, how do I then allow the titles to show for individual product pages?

Comments

Anonymous’s picture

I am not entirely sure of your setup in ubercart but there are several ways to do this.

You could write a if statement for this but its so minor that I dont think you should be using php for this. Its more a design issue then a development issue, css has more then enough power to get it done.

If you are using Zen or a theme that implements body classes you could just level down css classes to hit the element per page

example.(if it is created using a view)
.UBERCART-CATALOG-VIEW-NAME .content .title {
display:none;
}
or (if the body class is unique to ubercart catalog)
.UNIQUE-BODY_CLASS-NAME .content .title {
display:none;
}

So the first class tells css that its only on that page and the rest is the class of the title you want to remove.

If you are not using a theme that uses body classes ... well i would change themes, if they haven't added that then there is probably alot that they are not taking into consideration.

AlanT’s picture

This is fine for general use, but it does not take into consideration SEO consequences of having multiple H1 tags, which will happen if you simply hide one and show another.

I agree with you that we shouldn't need to use PHP to accomplish this, especially since headlines on sales pages (which is what catalog and product pages really are) are so important and cannot be handled with simple page titles.

So, we're still looking for a solution here.

- Alan Tutt

Exceptional Personal Development for Exceptional People
http://www.PowerKeysPub.com

AlanT’s picture

After spending several hours looking for the answer to this myself, I can offer you a hint.

Create a copy of your page.tpl.php and call it something like page-taxonomy.tpl.php or page-catalog.tpl.php (depending on exactly what you want to accomplish). In the new files, delete the line that prints the title. That's it.

Rather than complicate the core template file, just create a new one for the pages you want to alter.

For reference, check out the page at: http://drupal.org/node/1089642

- Alan Tutt

Exceptional Personal Development for Exceptional People
http://www.PowerKeysPub.com

KungLi’s picture

Hi there,

this works great on Firefox, but Safari won't do it. Any ideas on this?

Greetings

spadooky’s picture

a year and a half after the fact, but this was extremely helpful and exactly what i was looking for. thank you!