This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Newb needs help creating a basic node

I am new to the Drupal way of doing things and I've looked through a lot of docs pertaining to modules (and worked through a couple tutorials) but I'm still confused. Basically my main concern right now is that I can set up a node module (no block needed right now) and set up the settings function so that an admin user can change certain settings in the control panel. I don't really need all the advanced function hooks, just the basics plus the settings hook. What function hook do you use if you don't set up the module as a block?

Extend/Customize hook_settings?

I'll start this by saying that I'm working on my very first Drupal module, and I'm confused.

I'm trying to create a module that integrates Colourmod with Drupal to select colours. I've checked out the Colourmod installation instructions and the whole thing relies on some id's and classes being specified and detected by the scripts:

<div id="cmDefault">
	<div id="cmColorContainer" class="cmColorContainer"></div>
	<div id="cmSatValBg" class="cmSatValBg"></div>
	<div id="cmDefaultMiniOverlay" class="cmDefaultMiniOverlay"></div>
	<div id="cmSatValContainer">
		<div id="cmBlueDot" class="cmBlueDot"></div>
	</div>
	<div id="cmHueContainer">
		<div id="cmBlueArrow" class="cmBlueArrow"></div>
	</div>
	<div id="cmClose">
		<input type="text" name="cmHex" id="cmHex" value="FFFFFF" maxlength="6" size="9" /> <a href="http://www.colourmod.com" id="cmCloseButton" ><img src="/colourmod/images/close.gif" border="0" alt="Close ColourMod" /></a>
	</div>
	<div style="display:none">
		<input type="text" name="cmHue" id="cmHue" value="0" maxlength="3" />
	</div>
	<a href="http://www.colourmod.com" target="_blank" title="ColourMod - Dynamic Color Picker" class="cmLink">&copy; ColourMod.com</a>
</div>

So at this point I'm basically trying to get it working in the settings area to eventually specify "default colours" that would be able to be used by other modules. The problem is that the hook_settings only seem to allow form items and not any other code.

Could someone point out an example of a settings page that doesn't use the hook, a method to use the hook, or point out what I am missing?

Helper Script to migrate a module's from 4.6 to 4.7.

I started mucking around with Drupal 4.7 today. I was surprised by the total change to the forms API. I had already written a few modules for 4.6.3 and it was too much of a PITA to rewrite all the code manually. So instead I took a couple of hours to write a PHP script that would help me. Just put this somewhere in your drupal directory and access it through a browser.

custom image node -> 'File copy failed: source file does not exist.' error

Hi,
I am just learnign drupal and I mostly copy pasted together my own node module out of node example and the image.module with the help of this great thread:

http://drupal.org/node/30944

Everything works fine so far, but when I submit a new post with my own node I get the following error : 'File copy failed: source file does not exist.' Everything works fine though, drupal creates the thumbnails, previews and the original

hook_nodeapi and hook_filter ==> emtpy $text

I'm trying to modify my Drupal 4.6 in order to use an existing XML-format as input for nodes. I've successfully managed to impement a working filter.

In the XML there is allready a tag used to specify a teaser. To be able to extract the teaser from the XML I'v implemented hook_nodeapi to manipulate the $node->teaser as done in excerpt module.

It seems that all I need to do is to set $node->teaser ="Whatever I exctract from the XML..." in the switch ($op) ... case 'validate':

I've tried to track down what happens and here is what I can find out:

For node preview:

a) First hook_nodeapi $op == 'load' is called (if node already exist)

b) Next hook_nodeapi $op == 'validate' is called and $node->teaser is set.

c) Next hook_filter case 'prepare' is called with $text == my teaser as expected.

d) Now hook_nodeapi $op == 'view' is called. I guess this is a hook for the preview of the teaser.

e) Ok, so far so good. But next hook_filter is called again, but this time $text is empty!

I would expect $text to be set to the body of the node.

Any suggestion to what I'm doing wrong?

Currently I don't use the teaser features that comes with drupal, I'v done my own node-list generating functions. As a workarround, I could probably generate the teaser on-the-fly when needed. So as long as the teaser can be generated from the body, there should be no need (unless for speed) to store the teaser separately in the DB. On the other hand, if you do something similar to what is done in module exceprt (a separate input-field for the teaser) the node.teaser field is very handy. Is there any other reasons to have a seprate teaser field?

Blog Hosting Module?

Hey guys. I had a question. I know with Drupal each user can have their own blog and add content on it and others can comment on it as well. However I want to build a Blog Hosting site for a specific topic and have the following:

1) Catagories where when a user registers they have to choose what cat. their blog falls under that way when people go to the home page of the site they can click on the different cat. and browse all the users blogs.

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions