Hello everyone,

Could you please help me how can I replace the node title into a graphic image? I tried to make the changes in the FAQ section by creating a .faq-title css rule, but I can still see the text on top of it. So I tried to delete the css rule for node-title, but I could still see the text. Is there any way I can replace it? If so, what should I do as I am still new with php (but would like to learn it) - is there anything in the page.tpl section that I should get rid of to enable the use of my graphic images? My site is at astrologyloveadvice.com .. It's still new.

Thanks,
Anne

Comments

annicole72’s picture

Anyone?

When I created a rule for .faq-title under .node-title, that particular graphic image showed up on all pages. Is there a way I can replace text titles to customized graphic images?

Thanks,
Anna

WorldFallz’s picture

It's not the page.tpl.php file you want to edit but the node.tpl.php file. Look for something like <?php print $title; ?> and alter it however you wish-- or must remove it to supress the printing of the title all together. If you only want to do it for nodes of type 'faq', copy it to a new file named node-faq.tpl.php and edit that one instead.

annicole72’s picture

I tried to remove it, but then I got an error. Eekk..

annicole72’s picture

Ahh... so what should I put within those < > ? In the node.tpl, just remove that part and create a node-title for individual pages that I want to use graphic images instead of the title in text then?

WorldFallz’s picture

I'm not sure i understand-- how will you determine which nodes get pictures and which don't? I thought you were just trying to change this for nodes of one content type... what is the criteria?

annicole72’s picture

I created some graphics for each page/section: FAQ, FORUM, etc..

I was wondering if there is a way for me to use like faq.png (for the faq section), forums.png (for the forum section), etc..

You know how when we create a page, we have to type in a title? Instead of using text as the title, I want to use a graphic that I created in Photoshop.

Sorry if I've confused you.

WorldFallz’s picture

Ah ok, so it is by content type. Then you need to create a node-[contenttype].tpl.php file for each content type, remove the $title code I mention above, and just replace it with plain old <IMG> tags.

Alternatively, you could just use node.tpl.php, and add a bunch of:

<?php if ($node->type == 'faq'): ?>
  <img src='your_image.png' alt=$title />
<?php endif; ?>

One for each content type. That's just a guess-- you'll have to test and tweak it as necessary.

annicole72’s picture

Okay. I will give it a shot. I will keep you posted and come back here if I have any questions.

Thank you :)

Anna

RobW’s picture

You could also alter your template to add classes to your titles based on what content type they are, and then use css to style the title. For example,

<h2 class="<?php print $node->type ?>"><?php print $title; ?></h2>

Then use css like

h2.blog { 
height:50px;
width:200px;
background:url(yourimage.png) left top;
text-indent:-999em
overflow:hidden;
}

This approach would help keep your page semantic and keep you a little more accessible.