0

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.

1
  • What all methods have you tried so far? Commented Jan 17, 2013 at 15:49

2 Answers 2

3

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>
1
  • 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
    Commented Feb 9, 2013 at 3:24
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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