当前位置: 首页>>代码示例>>PHP>>正文


PHP node_build_content函数代码示例

本文整理汇总了PHP中node_build_content函数的典型用法代码示例。如果您正苦于以下问题:PHP node_build_content函数的具体用法?PHP node_build_content怎么用?PHP node_build_content使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了node_build_content函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: acquia_prosper_preprocess_node

/**
 * Node preprocessing
 */
function acquia_prosper_preprocess_node(&$vars)
{
    // Render Ubercart fields into separate variables
    if ($vars['template_files'][0] == 'node-product') {
        $node = node_build_content(node_load($vars['nid']));
        $vars['fusion_uc_image'] = drupal_render($node->content['image']);
        $vars['fusion_uc_body'] = drupal_render($node->content['body']);
        $vars['fusion_uc_display_price'] = drupal_render($node->content['display_price']);
        $vars['fusion_uc_add_to_cart'] = drupal_render($node->content['add_to_cart']);
        $vars['fusion_uc_weight'] = drupal_render($node->content['weight']);
        $vars['fusion_uc_dimensions'] = drupal_render($node->content['dimensions']);
        $vars['fusion_uc_model'] = drupal_render($node->content['model']);
        $vars['fusion_uc_list_price'] = drupal_render($node->content['list_price']);
        $vars['fusion_uc_sell_price'] = drupal_render($node->content['sell_price']);
        $vars['fusion_uc_cost'] = drupal_render($node->content['cost']);
        $vars['fusion_uc_additional'] = drupal_render($node->content);
    }
}
开发者ID:aakb,项目名称:alice,代码行数:21,代码来源:template.php

示例2: fusion_core_preprocess_node

/**
 * Node preprocessing
 */
function fusion_core_preprocess_node(&$vars)
{
    // Build array of handy node classes
    $node_classes = array();
    $node_classes[] = $vars['zebra'];
    // Node is odd or even
    $node_classes[] = !$vars['node']->status ? 'node-unpublished' : '';
    // Node is unpublished
    $node_classes[] = $vars['sticky'] ? 'sticky' : '';
    // Node is sticky
    $node_classes[] = $vars['teaser'] ? 'teaser' : 'full-node';
    // Node is teaser or full-node
    $node_classes[] = 'node-type-' . $vars['node']->type;
    // Node is type-x, e.g., node-type-page
    $node_classes[] = isset($vars['skinr']) ? $vars['skinr'] : '';
    // Add Skinr classes if present
    $node_classes = array_filter($node_classes);
    // Remove empty elements
    $vars['node_classes'] = implode(' ', $node_classes);
    // Implode class list with spaces
    // Add node_top and node_bottom region content
    $vars['node_top'] = theme('blocks', 'node_top');
    $vars['node_bottom'] = theme('blocks', 'node_bottom');
    // Render Ubercart fields into separate variables for node-product.tpl.php
    if (module_exists('uc_product') && uc_product_is_product($vars) && $vars['template_files'][0] == 'node-product') {
        $node = node_build_content(node_load($vars['nid']), $vars['teaser'], $vars['page']);
        $vars['fusion_uc_image'] = drupal_render($node->content['image']);
        $vars['fusion_uc_body'] = drupal_render($node->content['body']);
        $vars['fusion_uc_display_price'] = drupal_render($node->content['display_price']);
        $vars['fusion_uc_add_to_cart'] = drupal_render($node->content['add_to_cart']);
        $vars['fusion_uc_sell_price'] = drupal_render($node->content['sell_price']);
        $vars['fusion_uc_cost'] = drupal_render($node->content['cost']);
        $vars['fusion_uc_weight'] = !empty($node->weight) ? drupal_render($node->content['weight']) : '';
        // Hide weight if empty
        if ($vars['fusion_uc_weight'] == '') {
            unset($node->content['weight']);
        }
        $dimensions = !empty($node->height) && !empty($node->width) && !empty($node->length);
        // Hide dimensions if empty
        $vars['fusion_uc_dimensions'] = $dimensions ? drupal_render($node->content['dimensions']) : '';
        if ($vars['fusion_uc_dimensions'] == '') {
            unset($node->content['dimensions']);
        }
        $list_price = !empty($node->list_price) && $node->list_price > 0;
        // Hide list price if empty or zero
        $vars['fusion_uc_list_price'] = $list_price ? drupal_render($node->content['list_price']) : '';
        if ($vars['fusion_uc_list_price'] == '') {
            unset($node->content['list_price']);
        }
        $vars['fusion_uc_additional'] = drupal_render($node->content);
        // Render remaining fields
    }
}
开发者ID:maduhu,项目名称:opengovplatform-DMS,代码行数:56,代码来源:template.php

示例3: hook_update_index

/**
 * Update Drupal's full-text index for this module.
 *
 * Modules can implement this hook if they want to use the full-text indexing
 * mechanism in Drupal.
 *
 * This hook is called every cron run if search.module is enabled. A module
 * should check which of its items were modified or added since the last
 * run. It is advised that you implement a throttling mechanism which indexes
 * at most 'search_cron_limit' items per run (see example below).
 *
 * You should also be aware that indexing may take too long and be aborted if
 * there is a PHP time limit. That's why you should update your internal
 * bookkeeping multiple times per run, preferably after every item that
 * is indexed.
 *
 * Per item that needs to be indexed, you should call search_index() with
 * its content as a single HTML string. The search indexer will analyse the
 * HTML and use it to assign higher weights to important words (such as
 * titles). It will also check for links that point to nodes, and use them to
 * boost the ranking of the target nodes.
 *
 * @ingroup search
 */
function hook_update_index()
{
    $limit = (int) variable_get('search_cron_limit', 100);
    $result = db_query_range("SELECT n.nid FROM {node} n LEFT JOIN {search_dataset} d ON d.type = 'node' AND d.sid = n.nid WHERE d.sid IS NULL OR d.reindex <> 0 ORDER BY d.reindex ASC, n.nid ASC", 0, $limit);
    foreach ($result as $node) {
        $node = node_load($node->nid);
        // Save the changed time of the most recent indexed node, for the search
        // results half-life calculation.
        variable_set('node_cron_last', $node->changed);
        // Render the node.
        node_build_content($node, 'search_index');
        $node->rendered = drupal_render($node->content);
        $text = '<h1>' . check_plain($node->title) . '</h1>' . $node->rendered;
        // Fetch extra data normally not visible
        $extra = module_invoke_all('node_update_index', $node);
        foreach ($extra as $t) {
            $text .= $t;
        }
        // Update index
        search_index($node->nid, 'node', $text);
    }
}
开发者ID:sdboyer,项目名称:drupal-c2g,代码行数:46,代码来源:search.api.php

示例4: foreach

    </tr>
    </thead>

    <tbody>

    <?php 
$i = 0;
foreach ($table_rows as $row) {
    echo "<tr>\n                    <td class='" . $cat_class . "' ><a href='/revenue/year/" . $req_year_id . "/fndsrc/" . $row['id'] . "'>" . $row['name'] . "</a></td>\n                    <td class='" . $cat_class . "' >" . custom_number_formatter_format($row['adopted_budget'], 2, '$') . "</td>\n                    <td class='" . $cat_class . "' >" . custom_number_formatter_format($row['current_modified_budget'], 2, '$') . "</td>";
    foreach ($years as $year) {
        $amount_link = "<a href='/revenue/transactions/fundsrc/" . $row['id'] . "/year/" . _getYearIDFromValue($year) . "'>" . custom_number_formatter_format($row['revenue_collected'][$year], 2, '$') . "</a>";
        echo "<td class='" . $amount_class . "' >" . $amount_link . "</td>";
    }
    //echo "<td class='" . $amount_class . "' >" . custom_number_formatter_format(array_sum($row['revenue_collected']),2,'$') ."</td>";
    $widgetNode = node_load(285);
    widget_set_uid($widgetNode, $i);
    $additionalParams = array();
    $additionalParams["funding.funding"] = $row['id'];
    widget_add_additional_parameters($widgetNode, $additionalParams);
    $widgetChart = node_build_content($widgetNode);
    $widgetChart = drupal_render($widgetNode->content);
    echo "<td class='" . $amount_class . "' ><table><tr><td><a href='/revenue/transactions/fundsrc/" . $row['id'] . "'>" . custom_number_formatter_format(array_sum($row['revenue_collected']), 2, '$') . "</a></td><td>" . $widgetChart . "</td></tr></table></td>";
    echo "</tr>";
    $i++;
}
?>
    </tbody>
</table>
    
<?php 
widget_data_tables_add_js($node);
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:31,代码来源:revenue_fndsrc.tpl.php

示例5: zeropoint_preprocess_node

function zeropoint_preprocess_node(&$vars)
{
    $vars['template_files'][] = 'node-' . $vars['nid'];
    //print_r($vars);
    if ($vars['user']->uid) {
        $vars['content'] = preg_replace('~<foranonym>.*</foranonym>~s', '', $vars['content']);
    }
    $vars['content'] = preg_replace('~"http://baza-voprosov.ru/~', '"/', $vars['content']);
    // Build array of handy node classes
    $node_classes = array();
    $node_classes[] = $vars['zebra'];
    // Node is odd or even
    $node_classes[] = !$vars['node']->status ? 'node-unpublished' : '';
    // Node is unpublished
    $node_classes[] = $vars['sticky'] ? 'sticky' : '';
    // Node is sticky
    $node_classes[] = isset($vars['node']->teaser) ? 'teaser' : 'full-node';
    // Node is teaser or full-node
    $node_classes[] = 'node-type-' . $vars['node']->type;
    // Node is type-x, e.g., node-type-page
    // Add any taxonomy terms for node teasers
    if ($vars['teaser'] && isset($vars['taxonomy'])) {
        foreach ($vars['taxonomy'] as $taxonomy_id_string => $term_info) {
            $taxonomy_id = array_pop(explode('_', $taxonomy_id_string));
            $node_classes[] = 'tag-' . $taxonomy_id;
            // Node teaser has terms (tag-x)
            //      $taxonomy_name = id_safe($term_info['title']);
            //      if ($taxonomy_name) {
            //        $node_classes[] = 'tag-'. $taxonomy_name;                              // Node teaser has terms (tag-name)
            //      }
        }
    }
    $node_classes = array_filter($node_classes);
    // Remove empty elements
    $vars['node_classes'] = implode(' ', $node_classes);
    // Implode class list with spaces
    // Add node regions
    $vars['node_middle'] = theme('blocks', 'node_middle');
    $vars['node_bottom'] = theme('blocks', 'node_bottom');
    // Render Ubercart fields into separate variables for node-product.tpl.php
    if (module_exists('uc_product') && uc_product_is_product($vars) && $vars['template_files'][0] == 'node-product') {
        $node = node_build_content(node_load($vars['nid']));
        $vars['uc_image'] = drupal_render($node->content['image']);
        $vars['uc_body'] = drupal_render($node->content['body']);
        $vars['uc_display_price'] = drupal_render($node->content['display_price']);
        $vars['uc_add_to_cart'] = drupal_render($node->content['add_to_cart']);
        $vars['uc_weight'] = drupal_render($node->content['weight']);
        $vars['uc_dimensions'] = drupal_render($node->content['dimensions']);
        $vars['uc_model'] = drupal_render($node->content['model']);
        $vars['uc_list_price'] = drupal_render($node->content['list_price']);
        $vars['uc_sell_price'] = drupal_render($node->content['sell_price']);
        $vars['uc_cost'] = drupal_render($node->content['cost']);
        $vars['uc_additional'] = drupal_render($node->content);
    }
    // Node Theme Settings
    // Date & author
    if (!module_exists('submitted_by')) {
        $date = t('') . format_date($vars['node']->created, 'medium');
        // Format date as small, medium, or large
        $author = theme('username', $vars['node']);
        $author_only_separator = t('');
        $author_date_separator = t(' &#151; ');
        $submitted_by_content_type = theme_get_setting('submitted_by_enable_content_type') == 1 ? $vars['node']->type : 'default';
        $date_setting = theme_get_setting('submitted_by_date_' . $submitted_by_content_type) == 1;
        $author_setting = theme_get_setting('submitted_by_author_' . $submitted_by_content_type) == 1;
        $author_separator = $date_setting ? $author_date_separator : $author_only_separator;
        $date_author = $date_setting ? $date : '';
        $date_author .= $author_setting ? $author_separator . $author : '';
        $vars['submitted'] = $date_author;
    }
    // Taxonomy
    $taxonomy_content_type = theme_get_setting('taxonomy_enable_content_type') == 1 ? $vars['node']->type : 'default';
    $taxonomy_display = theme_get_setting('taxonomy_display_' . $taxonomy_content_type);
    $taxonomy_format = theme_get_setting('taxonomy_format_' . $taxonomy_content_type);
    if (module_exists('taxonomy') && ($taxonomy_display == 'all' || $taxonomy_display == 'only' && $vars['page'])) {
        $vocabularies = taxonomy_get_vocabularies($vars['node']->type);
        $output = '';
        $term_delimiter = ' | ';
        foreach ($vocabularies as $vocabulary) {
            if (theme_get_setting('taxonomy_vocab_hide_' . $taxonomy_content_type . '_' . $vocabulary->vid) != 1) {
                $terms = taxonomy_node_get_terms_by_vocabulary($vars['node'], $vocabulary->vid);
                if ($terms) {
                    $term_items = '';
                    foreach ($terms as $term) {
                        // Build vocabulary term items
                        $term_link = l($term->name, taxonomy_term_path($term), array('attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description))));
                        $term_items .= '<li class="vocab-term">' . $term_link . $term_delimiter . '</li>';
                    }
                    if ($taxonomy_format == 'vocab') {
                        // Add vocabulary labels if separate
                        $output .= '<li class="vocab vocab-' . $vocabulary->vid . '"><span class="vocab-name">' . check_plain($vocabulary->name) . ':</span> <ul class="vocab-list">';
                        //$output .= '<li class="vocab vocab-'. $vocabulary->vid .'"> <ul class="vocab-list">';
                        $output .= substr_replace($term_items, '</li>', -(strlen($term_delimiter) + 5)) . '</ul></li>';
                    } else {
                        $output .= $term_items;
                    }
                }
            }
        }
        if ($output != '') {
//.........这里部分代码省略.........
开发者ID:chgk,项目名称:db.chgk.info,代码行数:101,代码来源:template.php

示例6: dewey_render_node_body

function dewey_render_node_body($nid)
{
    $node = node_load($nid);
    $node->build_mode = DEWEY_BUILD_FULL;
    $node = node_build_content($node, FALSE, TRUE);
    // Set the proper node part, then unset unused $node part so that a bad
    // theme can not open a security hole.
    $content = drupal_render($node->content);
    $node->body = $content;
    unset($node->teaser);
    // Allow modules to modify the fully-built node.
    node_invoke_nodeapi($node, 'alter');
    return $node->body;
}
开发者ID:KyleAMathews,项目名称:dewey,代码行数:14,代码来源:template.php

示例7: theme

     if ($vote3['count'] > $vote) {
         $vote = $vote3['count'];
     }
     if ($result['fields']['sis_ratings'] == '0') {
         $vote = 0;
     }
     $votes = '<span style="margin-left: 20px;">(' . $vote . ' votes)</span>';
     $vote = 0;
     if ($result[type] == 'Dataset' && $value != 0) {
         print '<div style="width:100px; float:right;">' . theme('fivestar_static', $result['fields']['sis_ratings']) . $votes . '</div>';
     }
     print '<div style="width:580px; float:left ">' . strip_tags($text) . '<br/></div>';
     /* */
     $teaser = FALSE;
     $page = TRUE;
     $thisNode = node_build_content($thisNode, $teaser, $page);
     $statistics = statistics_get($thisNode->nid);
     if ($statistics == null) {
         $total_count = 0;
     } else {
         $total_count = $statistics['totalcount'];
     }
     //Popularity
     //	print '<div  class="item list-bullet" style="width:65px; margin-left: 55px;">'..'</div>';
     if ($result[type] == 'Dataset') {
         print '<div class="item list-bullet" style="width:220px; font-size:1em; padding-bottom:0px; "><a title="' . $thisNode->field_ds_agency_name[0][safe][title] . '" href="' . $base_url . '/search/apachesolr_search/?filters=is_cck_field_ds_agency_name%3A' . $thisNode->field_ds_agency_name[0][safe][nid] . '">' . $thisNode->field_ds_agency_name[0][safe][title] . '</a></div>';
     }
     //FileFormat
     //print_r($thisNode);
     print '</div></div>';
 }
开发者ID:maduhu,项目名称:opengovplatform-beta,代码行数:31,代码来源:search-results.tpl.php

示例8: elib_book_cover

 *
 * Template to render objects from the Ting database.
 *
 * Available variables:
 * - $object: The TingClientObject instance we're rendering.
 */
/*logic for rating */
elib_book_cover($object);
//dsm($object);
if (!($n = node_load(array('title' => $object->id, 'type' => 'bookrating')))) {
    $n = new stdClass();
    $n->type = 'bookrating';
    $n->title = $object->id;
    node_save($n);
}
$n = node_build_content($n);
?>
<!-- ting_object.tpl -->
<div id="ting-object" class="line rulerafter">

  <div class="picture unit ">
  <?php 
$image_url = ting_covers_collection_url($object, '170_x');
?>
  
  <?php 
if (strpos($image_url, 'imagecache')) {
    ?>
    <div class="inner left" style="margin-bottom:10px;">
      <?php 
    print theme('image', $image_url, $object->title, $object->title, null, false);
开发者ID:reload,项目名称:Netlydbog,代码行数:31,代码来源:ting_object.tpl.php

示例9: hook_search


//.........这里部分代码省略.........
 * capabilities. To do this, node module also implements hook_update_index()
 * which is used to create and maintain the index.
 *
 * We call do_search() with the keys, the module name and extra SQL fragments
 * to use when searching. See hook_update_index() for more information.
 *
 * @ingroup search
 */
function hook_search($op = 'search', $keys = null)
{
    switch ($op) {
        case 'name':
            return t('Content');
        case 'reset':
            db_query("UPDATE {search_dataset} SET reindex = %d WHERE type = 'node'", REQUEST_TIME);
            return;
        case 'status':
            $total = db_result(db_query('SELECT COUNT(*) FROM {node} WHERE status = 1'));
            $remaining = db_result(db_query("SELECT COUNT(*) FROM {node} n LEFT JOIN {search_dataset} d ON d.type = 'node' AND d.sid = n.nid WHERE n.status = 1 AND d.sid IS NULL OR d.reindex <> 0"));
            return array('remaining' => $remaining, 'total' => $total);
        case 'admin':
            $form = array();
            // Output form for defining rank factor weights.
            $form['content_ranking'] = array('#type' => 'fieldset', '#title' => t('Content ranking'));
            $form['content_ranking']['#theme'] = 'node_search_admin';
            $form['content_ranking']['info'] = array('#value' => '<em>' . t('The following numbers control which properties the content search should favor when ordering the results. Higher numbers mean more influence, zero means the property is ignored. Changing these numbers does not require the search index to be rebuilt. Changes take effect immediately.') . '</em>');
            // Note: reversed to reflect that higher number = higher ranking.
            $options = drupal_map_assoc(range(0, 10));
            foreach (module_invoke_all('ranking') as $var => $values) {
                $form['content_ranking']['factors']['node_rank_' . $var] = array('#title' => $values['title'], '#type' => 'select', '#options' => $options, '#default_value' => variable_get('node_rank_' . $var, 0));
            }
            return $form;
        case 'search':
            // Build matching conditions
            list($join1, $where1) = _db_rewrite_sql();
            $arguments1 = array();
            $conditions1 = 'n.status = 1';
            if ($type = search_query_extract($keys, 'type')) {
                $types = array();
                foreach (explode(',', $type) as $t) {
                    $types[] = "n.type = '%s'";
                    $arguments1[] = $t;
                }
                $conditions1 .= ' AND (' . implode(' OR ', $types) . ')';
                $keys = search_query_insert($keys, 'type');
            }
            if ($category = search_query_extract($keys, 'category')) {
                $categories = array();
                foreach (explode(',', $category) as $c) {
                    $categories[] = "tn.tid = %d";
                    $arguments1[] = $c;
                }
                $conditions1 .= ' AND (' . implode(' OR ', $categories) . ')';
                $join1 .= ' INNER JOIN {taxonomy_term_node} tn ON n.vid = tn.vid';
                $keys = search_query_insert($keys, 'category');
            }
            if ($languages = search_query_extract($keys, 'language')) {
                $categories = array();
                foreach (explode(',', $languages) as $l) {
                    $categories[] = "n.language = '%s'";
                    $arguments1[] = $l;
                }
                $conditions1 .= ' AND (' . implode(' OR ', $categories) . ')';
                $keys = search_query_insert($keys, 'language');
            }
            // Get the ranking expressions.
            $rankings = _node_rankings();
            // When all search factors are disabled (ie they have a weight of zero),
            // The default score is based only on keyword relevance.
            if ($rankings['total'] == 0) {
                $total = 1;
                $arguments2 = array();
                $join2 = '';
                $select2 = 'i.relevance AS score';
            } else {
                $total = $rankings['total'];
                $arguments2 = $rankings['arguments'];
                $join2 = implode(' ', $rankings['join']);
                $select2 = '(' . implode(' + ', $rankings['score']) . ') AS score';
            }
            // Do search.
            $find = do_search($keys, 'node', 'INNER JOIN {node} n ON n.nid = i.sid ' . $join1, $conditions1 . (empty($where1) ? '' : ' AND ' . $where1), $arguments1, $select2, $join2, $arguments2);
            // Load results.
            $results = array();
            foreach ($find as $item) {
                // Build the node body.
                $node = node_load($item->sid);
                $node->build_mode = NODE_BUILD_SEARCH_RESULT;
                $node = node_build_content($node, FALSE, FALSE);
                $node->body = drupal_render($node->content);
                // Fetch comments for snippet.
                $node->body .= module_invoke('comment', 'node', $node, 'update_index');
                // Fetch terms for snippet.
                $node->body .= module_invoke('taxonomy', 'node', $node, 'update_index');
                $extra = module_invoke_all('node_search_result', $node);
                $results[] = array('link' => url('node/' . $item->sid, array('absolute' => TRUE)), 'type' => check_plain(node_get_types('name', $node)), 'title' => $node->title, 'user' => theme('username', $node), 'date' => $node->changed, 'node' => $node, 'extra' => $extra, 'score' => $total ? $item->score / $total : 0, 'snippet' => search_excerpt($keys, $node->body));
            }
            return $results;
    }
}
开发者ID:rolfington,项目名称:drupal,代码行数:101,代码来源:search.api.php

示例10: node_load

      <?php 
}
?>
      <li><span class="gi-list-item">APT PIN:</span> <?php 
echo $node->data[0]["brd_awd_no"];
?>
</li>
      <li><span class="gi-list-item">PIN:</span> <?php 
echo $node->data[0]['tracking_number'];
?>
</li>
    </ul>
  </div>  
    <?php 
if (_getRequestParamValue("datasource") != "checkbook_oge") {
    echo '<div class="contract-vendor-details">';
    $nid = 439;
    $node = node_load($nid);
    node_build_content($node);
    print drupal_render($node->content);
    echo '</div>';
}
?>
  
</div>


  
  <script type="text/javascript">
  contractsAddPadding(jQuery('.oge-cta-details'));
</script>
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:31,代码来源:contracts_ca_details.tpl.php

示例11: node_load

<?php

if (arg(0) == 'node' && is_numeric(arg(1))) {
    // creating the node variable
    $workshop_event = node_load(arg(1), NULL, TRUE);
    $workshop = field_get_items('node', $workshop_event, 'field_workshop');
    $workshop = node_load($workshop[0]['target_id']);
    if ($workshop) {
        node_build_content($workshop);
        print render($workshop->content['field_sections']);
    }
}
?>

<?php 
print render($content['field_sections']);
?>






<section id="additional-info-support" class="bg-white">

    <div class="container">

        <div class="row">

            <div class="col-xs-12 col-sm-12 col-md-12 col-lg-5">
                <div class="row">
开发者ID:Stony-Brook-University,项目名称:doitsbu,代码行数:31,代码来源:node--workshop-event.tpl.php


注:本文中的node_build_content函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。