0

I have a content-type "foo". As you know, you can look at such a node by using it's nid and going to /node/nid. I'd like to create 100% custom markup and CSS for this page.

I want code and files and only code and files. So, what I'd expect is a MVC architecture, meaning, that there's a template file to which all the node related data is passed and I can easily change the markup. But since Drupal isn't MVC at all, it somehow gets very complex and I absolutely don't get the architecture here. I'm not sure can use one template only; if so what's the naming pattern?

Can someone tell me the cleanest and easiest way to create the HTML for the node page?

0

The easiest way is to create a new template file called node--[node-id].tpl.php, for example node--10.tpl.php

Then you just need to copy/paste your code from the node.tpl.php you have on your actual theme and change it like you want. For the CSS, the cleanest way I think is to add a custom class in your template high enough to be able in your CSS to target it.

You can have a look at this answer that explains the difference between node--[node-id].tpl.php and page--node--[node-id].tpl.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.