Drupal 7 Theming individual pages
I'm starting a Drupal 7 site and have noticed that almost every page will require a separate layout.
in order to style an individual node do i just name a template mode-NID-page.tpl.php or is there more to it?
I think i will also need to add gallery widgets, etc.. but i think that's a separat开发者_StackOverflow社区e matter. But would this involve displaying fields in the above template?
First off: I don't think it's a good idea to theme pages based on their NID.
That aside, here are two possibilities how you can achieve something like this:
Theme the normal node template, but include some logic there. You could for example include specific template files based on the NID. Not a clean separation of course, as such code should not go into templates. For a cleaner separation you could attach a custom field to the pages that holds the template file used for themeing.
As you want to create individual styles for different NIDs I assume that the number of those is not exorbitantly large. In that case, you could create separate content types. Each of the NIDs should then be converted into a node of that content type and of course each content type can have its own theme template then.
Downside of the second approach is that there might be some work involved if you have a lot of settings that would need to be transferred to the content types (e.g., permissions). But then again, the new pages will be nodes too, so most things should just work out of the box as they did before.
精彩评论