Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I'm reasonably new to Drupal... I've known about it for quite a number of years and have played around with it in the past, but only in the past 4 months have I started to make a serious website with it. Possibly a bit harder to configure than say WordPress, but so much more worth it when it's finished!

One thing that I'm trying to do is work with custom content types. What I am trying to do is create a custom content type called "Talk." In this I want to be able to specify a small description, an embed video URL and a link to PDF notes. I am having a really hard time to try and work out how to do that, and be able to customise it in a way I want.

What I want ultimately to be able to do is specify a HTML template for a custom field. That HTML then specifies where the fields appear (which may become problematic when there can be an undetermined number of entries for a particular field, but there could always be some way.)

Basically, let's say I specified the following

Summary: This is my summary
Embed: http://player.vimeo.com/video/51254497?title=1&byline=1&portrait=1
Notes: http://link/to/notes.pdf

I then want to be able to take those values and put them somewhere in HTML. For example...

<iframe src="" width="900" height="506" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="[Embed]" allowfullscreen=""></iframe><br>
<em>[Summary]</em><br>
<a href="[Notes]">Download corresponding notes</a>

Is there any way that I can create a custom content type that would give me that much control over my field? I've had a look but haven't been able to find any way, even with a module (though there's a good chance I haven't seen the right module!)

Thanks for any help, Josh.

share|improve this question
    
What all methods have you tried so far? –  Mohammed Shameem Jan 17 '13 at 15:49
add comment

2 Answers

up vote 3 down vote accepted

Think your looking into this a bit too deep for what it is.

For your fields you use the following:

  • Summary: Default field with any content type
  • Embed: http://drupal.org/project/youtube (not sure if theres something for vimeo)
  • Notes: Create a field that accepts PDf file extension

You then have loads of options for how you can present your content type. How about just creating a template file for that content type so...

node--type.tpl.php

You can then manipulate the output of the fields, for example...

<div class="somewhere-over-there">
    print render($content['youtube_field']);
</div>

<div class="somewhere-down-there">
    print render($content['pdf_field']);
</div>
share|improve this answer
    
Thank you. A combination of your answer and this video helped me do what I wanted: youtube.com/watch?v=sxZQqgvJk3s. I ended up altering each field individually (so field--field_vimeo.tpl.php allowed me to just specify the Vimeo video ID and I could put the embed code there.) –  joshhendo Feb 9 '13 at 3:24
add comment

You can create a unique page.tpl.php for a content type.

in your template.php file, add the following:

function yourtheme_preprocess_page(&$variables) {
$variables['theme_hook_suggestions'][] = 'page__node_' . $variables['node']->type; $nodetype = 'page__node_' . $variables['node']->type; }

You can then create a template file: page--node-contenttype.tpl.php

If your content type was "talk" it would be: page--node-talk.tpl.php

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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