ידידותי למדפסת - עיצוב לכל CCK

הי,
מותקן אצלי מודול printer friendly ואני רוצה ליצור theme לכל סוג תוכן (עבור ההדפסות).
יש לי אפשרות לעשות אותו משחק עם theme מהצורה: print-node_tyoe.tpl.php - כרגע זה לא עובד...

" יש לי אפשרות

"יש לי אפשרות לעשות אותו משחק עם theme מהצורה: print-node_tyoe.tpl.php "

מה ז"א? האפשרות הזו היא חלק מתכונות המודול?

תוכל להדביק לנו פה כמה חתיכות קוד לדוגמה?

זהר סטולר, לינווייט
לינווייט תשתיות תוכן קהילתיות

בבקשה

/**
* Outputs a printer friendly page.
*/
function print_generate_node($title) {
  global $base_url;

  /* We can take a node id or a node title */
  $node = (is_numeric($title)) ? node_load(array('nid' => $title)) : node_load(array('title' => $title));
  if (!$node->title) return false;

  $teaser = false;
  $page = true;
  /* This section is ripped from node_view.
     This does everything node_view does except theme the node! */

  // Remove the delimiter (if any) that separates the teaser from the body.
  // TODO: this strips legitimate uses of '<!--break-->' also.
  $node->body = str_replace('<!--break-->', '', $node->body);

  // The 'view' hook can be implemented to overwrite the default function
  // to display nodes.
  if (node_hook($node, 'view'))
    node_invoke($node, 'view', $teaser, $page);
  else
    $node = node_prepare($node, $teaser);
  // Allow modules to change $node->body before viewing.
  node_invoke_nodeapi($node, 'view', $teaser, $page);

  /* End of code stealing from node_view() */

  // associative array settings
  $print_settings = variable_get('print_settings', NULL);

  if (!isset($print_settings['urls']) || !empty($print_settings['urls'])) {
    /* Collect links and display them at the bottom of the page. Code once taken from Kjartan Mannes' project.module  */
    $pattern = "@<a.*?href=([\']?[\"]?)([^\"|^\'|^|^>]*)([^>]*)>(.+?)</a>@ise";
    $node->body = preg_replace($pattern, "'<u>'.stripslashes('\\4').'</u> ['. print_friendly_urls(stripslashes('\\2')) .']'", $node->body);
    $urls = print_friendly_urls();
    if (count($urls)) {
      $node->pfp_links = '';
      $max = count($urls);
      for ($i = 0; $i < $max; $i++) {
        $node->pfp_links .= '['. ($i + 1) .'] '. $urls[$i] ."<br />\n";
      }
    }
  }

  init_theme();
  $node->logo = !empty($print_settings['logo_url']) ? $print_settings['logo_url'] : theme_get_setting('logo');

  /* Grab and format the src URL */
  $node->source_url = $base_url . url("node/$node->nid");
  $node->language = $GLOBALS['locale'];
  $node->printcss = empty($print_settings['css']) ? 'misc/print.css' : $print_settings['css'];

  $robots_meta = _print_robots_meta_generator();

  include_once('print.node.tpl.php');
}

קיימת גם פונקציה מקבילה לפרופיל המשתמש...
(לא שזה רלוונטי לי)

עקפתי את הבעיה

בעזרת arg.
פשוט אמרתי ל-theme שלי להדפיס חלקים מסויימים רק כאשר אנו לא במצב הדפסה.
במצב זה מתווספת המילה: print לכתובת הדף הנצפה...

חדש באתר