1

I am using cctags module for getting all the list of tags , I already stored the several tags for each node separately using the content type, now i need to display the specific tag when the node loads , but the cctags module will display all the tags in the term data.

     if(empty($nodevalue->field_beachestags)){
    $tagvale=array(explode(",",$nodevalue->field_beach_migratetagshidden[$nodevalue->language]['0']['value']));        
    foreach ($tagvale as $term_name) {
    foreach ($term_name as $termtag) {
        $terms_matched = taxonomy_get_term_by_name($termtag, 'tags'); // "beach_terms" is the machine name of vid 1.
        if ($terms_matched) {
            //We blindly use the first match. Not very elegant.
            $first_term = current($terms_matched);

            $nodevalue->field_beachestags[$nodevalue->language][]['tid'] = (array) $first_term->tid;
        } else {
            $term = new stdClass();
            $term->name = $termtag;
            $term->vid = 1; // Vid from the question.
            taxonomy_term_save($term);
            $nodevalue->field_beachestags[$nodevalue->language][]['tid'] = (array) $term->tid;
        }
    }
     }
 node_save($nodevalue);
 }

but there is a field called "field_data_field_tags " it does not contain any value for the reference of the node and the tags, I am not able to get the related tags to display for the node .

When i load the node i must display the related tags whichs is related to the field_beachestags. Any suggestion and help welcome .

0

Your Answer

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

Browse other questions tagged or ask your own question.