CCK help please.

jmspldnl - March 28, 2008 - 02:10

Not sure how possible or easy this would be to do. I would like to create special content type for video sermons on my site. I want to be able to have fields for sermon title (easy), scripture (easy), preacher (easy), and then the date of the sermon (somewhat easy). I would then like CCK to somehow automatically find the sermon video and input the proper code for swf tools. I have the file structure on the sermon in a way that should be really easy to have it find the sermon just by the date. I have the sermons broken down in folder by year, and then the videos filename is the date of the sermon.

For example, a sermon would be: sermons/2008/03-20-08.flv

I'm good enough with php, that I could probably write the code to do this myself. The only problems I have ran into is I'm not sure if I should just have them input the date into a text field, or if I should use the date field and then try to get it to display it the way I want it. I also don't know where to put the code to swf tools in the CCK stuff. I've never used CCK before, so I'm not sure how to do these kind of things, or if it is even possible.

If you need to know any more information, I will try to explain in greater detail, if possible. Thanks for your time.

sounds like something maybe

WorldFallz - March 28, 2008 - 02:27

sounds like something maybe the cck computed field could help you with. Maybe you could use php to spit out a link directly to the file....

You might find themeing

zeta ζ - March 28, 2008 - 03:00

You might find themeing gives you more control: Copy the modules/cck/theme/field*.tpl.php files into your theme (and change my_field in the file name). This will give you a file to your code into (put something obvious in to make sure cck has noticed the files).
___________________
It’s in the detaιls…

An example please?

jmspldnl - March 28, 2008 - 03:43

I'm not real sure how to theme it to get what I want. I'm not real good with the drupal stuff. I know php well enough to get by, but I'm not a pro, because I'm all self taught. Thanks for this tip though. I think you are probably right, I'm just not sure how to.

If you copy the files

zeta ζ - March 28, 2008 - 03:53

If you copy the files I’ve indicated, you should notice inside field-field_my_field.tlp.php (renamed to field-field_video.tlp.php or whatever) the php that actually prints the contents of the field.

<?php
print $item['view'];
?>
You can then add to, and manipulate this string to what you want.

There’s always the documentation to fall back on ;-)
___________________
It’s in the detaιls…

Thanks

jmspldnl - March 28, 2008 - 04:04

I saw that bit of code, but I was unsure how that would help me. I'm not sure I need to edit a field, unless I can just add the video onto one of the fields. I guess I could just add it to the date field itself. The big problem with that is if I decided to move the fields the video might not display where I want it. IF I made field that didn't appear on the edit page, could I get it to still appear when people view the page. That way I could make a video field or something that I just program to display the way I want it.

 
 

Drupal is a registered trademark of Dries Buytaert.