views:

1128

answers:

6

I am working on developing a drupal site right now. I have created a custom homepage and it works fine with a module called (front page). However, I need to create a custom page for an internal page. Meaning, I need to have a different design than the general drupal theme I have right now but I am not sure how to do that (in an easy way that wouldn't take much time). I have the design in HTML and CSS ready but i just need to have something like (custom page) in the menu so when i click on it it takes me to that design (not external link though!)

I hope this was not confusing but if you have any questions I will be glad to answer them.

Thank you for your help in advance :)

A: 

Unfortunately there's not really any way to do it "in an easy way that wouldn't take much time". If you want to theme your site you have to learn to theme. How long it takes you will depend on how much you want to deviate from the default theme templates. Here's a good place to start reading: http://drupal.org/theme-guide/6

Also, you may want to consider the Zen theme as a base theme. It will help you follow best practices. http://drupal.org/project/zen

Aaron
ohh i have a theme for the whole site, however, one of the pages is going to have more "design" than the other pages just because it will have a different layout, so i just need to have a different layout for that page.
Doing a different layout for just one page isn't really any different than doing a different layout for all pages. You can either create a new theme that's an exact copy of your current theme and make necessary modifications for your special page, or use a module like ThemeKey or Sections to choose between different themes for different parts of your site. But no matter what you do you're going to need to learn how theming in Drupal works.
Aaron
I should add that the specific changes you need to make may, in fact, be quick and easy. Maybe a simple modification to page.tpl.php is all you'll need. But most layout modifications in Drupal (even seemingly simple changes) usually require modifying many different files, using preprocessors, and actually learning how the theming system works.
Aaron
A: 

If you simply need a different template for ALL internal pages and one for the front page you cna jsut use page.tpl.php (thats for internal/default pages) and page-front.tpl.php (for the front page).

Otherwise there isnt a "quick and easy" way to do that, however there aer multiple ways. Read the themeing guide as Aaron suggests and figure out what best meets your needs.

prodigitalson
+4  A: 

Html overiding

For a single page, you can create whatever html you like with drupal, using

  • templates
  • theming functions
  • Write the exact html yourself, creating a theming function or just putting it in a template while.

Since you want a unique layout you want to look into a custom page.tpl.php. You can create a page.tpl.php for any url, which will allow you to modify the entire page html for that page, or just tweak it here and there.

Drupal has a quite flexible theming system, so there are many ways to change the markup. All of this stuff would need to go into your theme or a module.

CSS overriding

You will still have the css files that are used in the drupal site.

  • You can add additional stylesheets, with drupal_add_css(), but you might have problems with the other style sheets conflicting.
  • You can remove all other stylesheets in template.php or remove them from your page.tpl.php, but then drupal_add_css wont work either.
    • If you do this, you could generate the link to the css file yourself, in
      • your markup
      • template.php
      • the page.tpl.php file.

Static page

If your aim is to create one on only on page, with different layout ect, the quickest and easiest way, would be to create our own page.tpl.php file, and just write all your html in there and forget what Drupal can do. It's not generally a best practice, but in this case, doing stuff with the flexibility of Drupal might be a bit overkill, especially if you don't know Drupal well. You could possibly with the page template naming convention do this aproach, just adding a file with your markup in your theme. This approach would be good for a static site, but can also be done with a bit more effort for other pages. If you want to use a lot of modules, this wont be the solution for you. You should instead look at the theming functions / template.php and what can be done there.

Change your Drupal backend / admin theme

If your aim is to create a backend theme, drupal has several modules for this, the most used these days is probably the admin module. Even if this is not your aim, this is a great module to make your backend a bit more user friendly.

googletorp
+2  A: 

You can use an individual template for an individual page, but how to do that will change a lot from where your content is coming from. Some examples:

  • Your page is a view. You will need to copy and modify a template from the views module directory to the theme one and rename it according to your view. In order to know which template you have to click "theme information" in the views UI and pick a suitable name amongst the one proposed.

  • Your page is a node of a type which is used only for that page. You will need to make a copy the node.tpl.php file an call it node-my_type_of_node.tpl.php instead.

  • Your page is provided by a custom function. You have to implement hook_theme() and tell drupal what is the associated template file to be used.

  • Your page is a normal page with a normal node in it. You will have to follow the technique described here (essentially modifying your template.php file in order to explain drupal how to look for templates on the basis of the node id, and then creating a node-my_nid.tpl.php file).

  • More cases. More solutions.

In a nutshell: there are easy and quick ways of implementing what you need, but you need to have a good understanding of the general theming mechanism in drupal, exactly as there are easy and quick ways of writing an e-mail, but you should know grammar, have some vocabulary, and knowing how a email software works. The link posted by Aaron (the drupal official theming guide) is the canonical place to start from.

Hope this helps!

mac
A: 

So the solution is have something like :

page-node-7.tpl.php

for page that has a path of (node/7) for example. And then it will load that page instead of the drupal page node/7

Thanks everyone :)

1) I see you are new on SO, so let me just point out that you should know when to make a comment, when to post an answer and when to edit your question. In this case you should have edited your original question adding the extra information, so that everybody would immediately know what you wanted to do. Also don't forget to upvote all useful answers and select as "accepted" the one - if any - that solves the problem for you. 2) The point **Your page is a normal page with a normal node in it** in my answer explains how to do what you are asking here. 3) Cheers and welcome on SO! :)
mac
A: 

You can use the module Themekey (http://drupal.org/project/themekey) which is a generic theme switching module.

You want to switch the theme ... ... for different taxonomy terms? ... based on the node type? ... for different languages? ... based on the path? ... then ThemeKey is probably worth a try ;)

Other hand is use a preprocess function and change the 'theme' keyword in the variables.

eaguilar

related questions