Solved

drupal background different page classes

Posted on 2010-09-01
13
340 Views
Last Modified: 2012-05-10
this is in my page.tpl.php

<body id="<?php print $body_id; ?>" class="<?php print $body_classes; ?>" >
  <div id="page" class="page">
    <div id="page-inner" class="page-inner">
      <div id="skip">

my drupal site has a repeating background image in body,
and a static image in page div

how do i render different page classes or ids for different nodes?
i want if im on music node, music page,    
this div becomes
<div id="page-music" class="page-music">
something like this, so i can have differnt static images on different node pages

i came across this
http://www.packtpub.com/article/dynamic-theming-in-drupal6-part1

seems like to make this happen
i can simply make a page-music.tpl.php

but i tried, drupal didnt seem to load the page-music.tpl.php even if i deleted the page.tpl.php




any ideas?
0
Comment
Question by:charmingduck
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
13 Comments
 
LVL 17

Expert Comment

by:Thomas4019
ID: 33582674
The easiest way to do this is via the URL. Make all the music pages be example.com/music/*. Then you can use a page-music.tpl.php. Use a different keyword for each page type.

Installing the Theme Developer module will tell you the possible template names for the page you are currently on.
0
 

Author Comment

by:charmingduck
ID: 33582748
I tried this already, but it didnt work, why??????????
0
 
LVL 17

Expert Comment

by:Thomas4019
ID: 33582784
Maybe you need to flush your caches. Install the theme developer module and see what is suggests for template file names.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:charmingduck
ID: 33582798
okay, im gonna try it
0
 
LVL 17

Expert Comment

by:Thomas4019
ID: 33582802
sounds good, just make sure to disable it when you're done. (i.e. only have it enabled when you're debugging)
0
 

Author Comment

by:charmingduck
ID: 33582976
i saw this

template called:
page.tpl.php
candidate template files
page-node-143.tpl.php < page-node.tpl.php < page.tpl.php


what does it mean? this page is www.ex.com/music/shiens 

why is it that    there's no music    in the name of the template files?
0
 
LVL 17

Expert Comment

by:Thomas4019
ID: 33582995
According to this, http://drupal.org/node/104316, it should have page-music.tpl.php. There must be something unique about your setup.
0
 

Author Comment

by:charmingduck
ID: 33583002
what could it be?
0
 
LVL 17

Expert Comment

by:Thomas4019
ID: 33583003
This looks like it might have a solution, http://www.informit.com/articles/article.aspx?p=1336146&seqNum=7.
0
 
LVL 17

Accepted Solution

by:
Thomas4019 earned 250 total points
ID: 33583015
I actually think your problem is normal, to quote a comment from this page, http://drupal.org/node/104316.

"Remember that these template suggestions are based on the default drupal path for a particular page. If you've used the path or pathauto module to hide them with url aliases, these templates will still be searched based on the original paths."

You're going to have to find a special way to make it use the url alias version.

Hmm, I'm now thinking using this module would be an easier solution, http://drupal.org/project/node_page.
0
 

Author Comment

by:charmingduck
ID: 33583068
well, what can i say,

man, you are simply awesome

im gonna try this as well
0
 

Author Comment

by:charmingduck
ID: 33583164
great, node_page does work!!!!!!!!!!!!!!!!!!!!
0
 
LVL 17

Expert Comment

by:Thomas4019
ID: 33583170
fabulous!, glad to help :)
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Creating content driven views + menus 1 237
How to prevent being tagged as spam 6 163
eCommerce for drupal 3 174
Display submission history of a node? 2 101
This article is for those that are having major problems with users upload files such as pictures to their profile. The solution is simple and has to do with correcting the directory paths. With some experimenting and testing i got it fixed. Note…
RTL (right to left) web applications aiming for audiences speaking languages like Hebrew or Arabic, are generally more complicated than the same applications aiming for audiences speaking Latin based languages. The main difference lies of course …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question