By LateNightDesigner on
I've been searching all morning and can't seem to find a easy way to do this:
If I create a new Content Type, is there a way to pre-define the content of the body?
Example: Say I create "Video Blog" as a content type. And then in the settings, I would like to paste in the code for the layout. A simple 2 div layout for the video and a short description. So, when a user creates a new Video Blog, the body already has the layout and they just have to fill in the pieces.
Without having to copy the code every time, is there a way to standardize the content?
I know I could probably fix it with CSS, but the users prefer they have something to look at. The customer is always right. :)
Comments
In Drupal the input/data is
In Drupal the input/data is separated from the presentation (or at least it is meant to be). The layout is meant to be controlled through theming.
So, there would be no way to
So, there would be no way to auto fill the body text area with pre-defined code?
You could write a custom
You could write a custom module that alters the form (there is no default value for the body).
I can see a huge use for a
I can see a huge use for a module that lets you predefine fields site wide...Everything from submission forms to content types. If it's as simple as "Enter your name here..." to fully body content of a node. The question is, are there hooks in place for that?
Hmm, now to find some time...
_
CCK fields already have a default value option. With d6 though, the core body 'field' isn't really a field and doesn't have a 'default value' option (which it does in d7).
As nevets said, you can use hook_form_alter to preset the body value. But from your op, it really sounds like what you want is a couple of fields to capture the 'pieces' of info to be entered by users (like 'video url' and 'description') and a custom node-video.tpl.php (where 'video' is whatever you named the content type) template file that assembles and presents that info in the format you desire.
@WorldFallz: Yeah, that
@WorldFallz: Yeah, that should work out better. A few CCK textareas and just style them with some css and a tpl. It won't always be a video, but the layout would be consistent if they chose to post say... an image instead. Much easier than a whole module, though I still like the idea.
Thank you, "Default value" was the phrase I should of been searching for earlier, just wasn't thinking in terms of form elements.
Great, looks like I have some content types to remake! :D