For a site i have designed, i want the h2 class=pagetitle to not show on the front page and have achieved it with:

        <?php if (!$is_front): ?>
        <h2 class="pagetitle"><?php print $title ?></h2>
        <?php endif; ?>  

I have done so as the css of the node title and the page title are incompatible (unfortunately, i do not have a sandbox site online to illustrate). This works fine when on the front page (h2 class=pagetitle is not shown) and on node pages as the node title assumes the css: h2 class=pagetitle.

On teaser pages based (i.e blog, via taxomony, etc) i have the page title (h2 class=pagetitle) above the node title. What i would like to do is to have a different css for the page title on teaser pages.

I might be going about this the wrong way??

I have tried

        <?php if ($is_node): ?>
        <h2 class="pagetitle"><?php print $title ?></h2>
        <?php endif; ?>  

and it works as wanted for the front page (not shown), yet i read somewhere that drupal 5 does not recognise this?? It does not work either way.

Perhaps this could be because of the /path?? The site would be using pathauto. I am a little unsure of how to approach this.

I know i could create different page.tpl.php files for each taxonomy, though think that is overkill??

Anyone able to offer a way forward?

thanks
c.

Comments

avolve’s picture

i have also tried

        <?php if (arg(0) ="node"): ?>
        <h2 class="pagetitle"><?php print $title ?></h2>
        <?php endif; ?>

and

<?php if (arg(0) !="node"): ?>
        <h2 class="pagetitle"><?php print $title ?></h2>
        <?php endif; ?>

and

<?php if (arg(0) !="/**"): ?>
        <h2 class="pagetitle"><?php print $title ?></h2>
        <?php endif; ?> 

all with either the class showing up on the front page, or the class not showing up on node pages. I have looked through the handbook for this (where i got these snippets from)... I am not a php coder (which might be obvious based on this) and not sure what to do to achieve this...

avolve designs | ethical by design

discursives’s picture

interesting question, let you know if i find something!

avolve’s picture

here is the what i put together

<h2 class="pagetitle<?php if (!$is_front) { print '-visible'; } ?><?php if ($node) { print '-node'; } ?>"><?php print $title ?></h2>

with the following css h2 classes:

.pagetitle --> for the front page (specific to the site design) - i needed this as i have a top border for .pagetitle-visible i wanted hidden on the front page (essentially a style-less css tag)

.pagetitle-visible --> for all page title's on teaser pages, etc

.pagetitle-visible-node --> for all single node pages

Please note, i am not a php programmer, so this might not be the optimum method?? I think the code looks pretty good though!

Cheers,
c.

avolve designs | ethical by design

arebos’s picture

it works in my template.
thanks for your effort.