By alraben on
Hi,
I want to create own 12 content types. Then I want to create 12 page-own-content-type.tpl.php templates for each created content type.
Well, the question is that the $content variable that appears in the different templates, print nodes of that particular content type or all published nodes?
How can I modify the $content variable of each template to show nodes of that content type instead all published nodes
Thanks,
Comments
The $content variable will be
The $content variable will be built automatically, based on the settings of your content type. So if you add fields, change the order, hide labels, change the comment settings etc. etc., those changes will be reflected in $content.
Are you sure you need 12 page templates? I don't know your design, but often it's easier to have just one page template and use multiple node templates (node-contenttype.tpl.php) instead. Also, you might want to look into preprocess functions, because they can change variables based on the content type before the variables are sent to the template.
Hope that answers your question.
Hi again, I'm not an expert
Hi again,
I'm not an expert in Drupal. I need to have 12 pages where 12 users only publish content into their page and I need that these pages have similar theme elements in common but not all. These 12 users are going to be countries and for example one thing that it's going to be different is the flag.
How can I implement that requeriment?
Thanks
In drupal, the content type
In drupal, the content type defines the form where the user or administrator can input data. By default, a content type contains fields for title and body text, but using the CCK module you can add more fields if you want, for instance an image upload field for the flag. Different content type can have different fields. If all your content ('nodes' in drupal jargon) can described with the same set of fields, you only need one content type.
When you say "12 users publish content into their page", do you mean that every user has one single page (ie. www.example.com/usa) where he can edit the contents of that page? Or will every user have a section where all articles by that user are listed? Anyway, I think you need to read some more documentation to make sure you really understand what drupal can do, and to get familiar with the Drupal terminology. A couple of links:
getting started: http://drupal.org/getting-started
terminology: http://drupal.org/node/937
site recipes: http://drupal.org/handbook/site-recipes
Hi marcvangend, Thanks for
Hi marcvangend,
Thanks for answering.
Yes, I mean the second one. Every user have a section where all articles are listed. It's like a 12 blogs (1 blog per user) but trying to using different blog template if it's possible in Drupal, I don't know.
The main idea is the following:
"Each User have a page where can publish their content and can promote content to the home page. These pages are going to have differences in the themening like a flag or another images but always respecting the main themeing." What's is the best form to implement that?
1) Create 12 Users with one blog template?
2) Create 12 Users with 12 blog templates if it's possible.
3) Create 12 Users with 12 content type and a template for each content type ...
Thanks for all and your help!!!!
Sorry for my English :s.
Thanks for the explanation.
Thanks for the explanation. Thinking this through before you start is really important for a site like this, so it's great that you are taking the time to do so. On the other hand, it can also be helpful to install Drupal now and start playing with the possibilities mentioned here and in the documentation. Drupal is a very flexible system and sometimes that means that there is more than one way to solve your problem. In that case, experiment a little and see what works best for you.
In your case, I would use option 2). Option 1) is not what you're looking for and option 3) makes things too complex. Drupal uses the concept of theme overrides (see http://drupal.org/node/341628) which means that there is a default output, but you can override it if you want. You need to override the main page template (page.tpl.php) and replace it with your own. You can also create multiple page templates (ie. page-usa.tpl.php, page-es.tpl.php) but then you have to tell Drupal which template to use. That is when "template suggestions" come in to action (see http://drupal.org/node/223440). A template suggestion is added in a template preprocess function, which is a function where variables for a certain template can be altered or added. You need to write some php code which looks at the page being shown, decides in which section it belongs, and sets the
$variables['template_file']variable. If you have 12 authors and those authors can only post in their own section, you could easily switch templates based on the node's author.For the listings of nodes, I would use the Views module.