Hi Travis and co,

For those that like to completely rely on cck fields in their node template files and have nothing to do with the body field, you can now put the [video] tag in your custom fields and call the $node->cckfield[0]['view'] for that field within your node-ccktype.tpl.php file and it will parse and display now independent of the body field or $content variable. This may have already been there but I couldnt get it to work. I added this in the 4.7 version but wasnt sure if it was taken over to the 5 version.

Code to add in is as of version 5.2 beta 4 line 1596 :

foreach ($node as $key => $value){
		
		if (strcmp(substr($key,0,6),'field_')==0){  //check to see if the fields have the cck field_ tag on the field names.
			
			$field_array = array();  // create an array for the dataset
			$field_array = $node->$key;  // get the field array from the node
			$cck_body = $field_array[0]['view'];
			for($pos = 0; (($pos = $startpos = strpos($cck_body, $tag, $pos)) !== FALSE); $pos++) {    // Search for tags
      		// We need to check to see if this tag has "!" in front of it, if it does, then we will ignore this tag.
      			if(substr($cck_body, $pos - 1, 1) == '!') {
         			$body = substr_replace($cck_body, $tag, $pos - 1, strlen($tag) + 1);
      			}
      			else { 
         			$pos++;                                             // So that it will skip over the "[".
         			$params = array();
         			$params = _flashvideo_parse_params($cck_body, $pos);    // Parse all the parameters.
         			$object = ($tag == '[thumbnail') ? flashvideo_get_thumbnail($node, $params) : flashvideo_get_video($node, $params);
         			$cck_body = substr_replace($cck_body, $object, $startpos, ($pos - $startpos));  // Replace this tag.
      			}
   			}
			$field_array[0]['view'] = $cck_body; // put back the content
			$node->$key = $field_array;  // assign back to the node.
		}
	}

Hope that makes sense.

ore

Comments

chris.wells’s picture

Sorry to sound dumb, but where does the above code belong?

I'm running Drupal 5.8, CCK 1.5 and FlashVideo 2.7

Basically I'm having the same problem as you (I think) with [video] not parsing, but just showing up like [video] in a CCK field.

travist’s picture

Status: Active » Fixed

This code would go in the php.tpl file for your video node type.... Or if you are using Contemplate, this would go in your template for that node type.

Hope this helps.

Travis.

chris.wells’s picture

Is there anywhere in particular to place it within tpl.php. At the top? Or does it need to wrap around the current content?

The video is being attached to a node type and embedded within 2 paragraphs of text which are held in a CCK field.

travist’s picture

Actually, now that I look at it, it appears that this code is to replace the parse tags routine that I have in the flashvideo.module. I believe he states which line that is above his code. This is more or less a patch than code to place in your page.

chris.wells’s picture

Status: Fixed » Postponed (maintainer needs more info)

I've tried to add it to the function - I think the line number has changed for the latest version of Flashvideo - but I still can't get it to work.

Could you possibly take a quick look at the latest code and see if you can figure out where/how it shoehorns in?

I think that it goes in to the function on line 1837, but clarification would be needed.

Thanks in advance.

attheshow’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Closed due to inactivity.