Bil sem naprošen, če lahko odpravim napako na strani www.oratorij.net, oziroma 
poiščem pomoč drugje :)
V header-ju se vsak dan prikaže druga slika in ko pridejo vse na vrsto, je en 
dan prikazano belo ozadje, potem pa stvar dela naprej normalno. Kdor obvlada, 
bo napako odkril v hipu, jaz pač ne. Prilagam kodo. Hvala lepa.
<?php

/**
 * @file
 * Omnious, CSS-driven theme.
 */

function oratorij_features() {
  return array(
       'logo',
       'toggle_name',
       'toggle_slogan',
       'toggle_primary_links',
       'toggle_secondary_links');
}

function oratorij_page($content, $title = NULL, $breadcrumb = NULL) {
  // Path to theme
  $themepath = "$GLOBALS[base_url]/themes/oratorij/";
  $themepath = "themes/oratorij/";
  // Title
  if (isset($title)) {
    drupal_set_title($title);
  }
  // Help
  if ($x = menu_get_active_help()) {
    $help = "<div id=\"help\">$x</div>\n";
  }
  // Breadcrumb
  $breadcrumb = theme("breadcrumb", drupal_get_breadcrumb());
  // Language
  $language = $GLOBALS['locale'];
  // Site name
  $sitename = variable_get("site_name", "drupal");
  // Site Slogan
  $siteslogan = variable_get("site_name", "drupal");
  // Additional styles
  $themestiles = theme_get_styles();
  // Body OnLoad
  $bodyonload = theme_onload_attribute();
  // Primary and secondary links
  $primary_links = theme_get_setting('primary_links');
  $secondary_links = theme_get_setting('secondary_links');
  // Left and right blocks blocks
  $blocks_left = theme_blocks("left");
  $blocks_right = theme_blocks("right");
  // Tabs for local tasks
  $tabs = theme('menu_local_tasks');
  // Theme closure
  $themeclose = theme_closure();


        // We setup an image for the header here:
                $bgpics = array();
                if ($handle = opendir("${themepath}pic/headerimages")) {
    while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != "..") {
            array_push($bgpics, "${themepath}pic/headerimages/".$file);
        }
    }
    closedir($handle);
                }
                $i = date("nj");
                $e = 0;
                while ( $i > 0) {
                        if ($e > count($bgpics) ) {
                                $e = 0;
                        }       else {
                                $e++;
                        }
                        $i--;
                }
  //  The actual design and HTML gets sucked up here

  $output .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
  $output .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" 
\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\";>\n";
  $output .= "<!-- Created by PIG | planning and intercommunication group | 
http://www.pig.si -->\n";
  $output .= "<html xmlns=\"http://www.w3.org/1999/xhtml\"; 
xml:lang=\"$language\">\n";
  $output .= "  <head>\n";
  $output .= "          <title>$title | $sitename | $siteslogan</title>\n";
  $output .= "          <meta http-equiv=\"Content-Type\" content=\"text/html; 
charset=UTF-8\" />\n";
  $output .= "          <style type=\"text/css\" media=\"screen\" 
title=\"Stil\">@import url(\"${themepath}style.css\");</style>\n";

  $output .= "          <!-- compliance patch for microsoft browsers -->\n";
  $output .= "          <!--[if lt IE 7]>\n";
  $output .= "                  <script src=\"${themepath}ie7/ie7-standard.js\" 
type=\"text/javascript\"></script>\n";
  $output .= "                  <script src=\"${themepath}ie7/ie7-strict.js\" 
type=\"text/javascript\"></script>\n";
/* for new one
  $output .= "                  <script 
src=\"${themepath}ie7/ie7-standard-p.js\" type=\"text/javascript\"></script>\n";
  $output .= "                  <script 
src=\"${themepath}ie7/ie7-css3-selectors.js\" 
type=\"text/javascript\"></script>\n";
  $output .= "                  <script 
src=\"${themepath}ie7/ie7-css-strict.js\" type=\"text/javascript\"></script>\n";
*/
  $output .= "                  <style type=\"text/css\" media=\"screen\" 
title=\"Oratorij default\">@import url(\"${themepath}ie.css\");</style>\n";
        $output .= "            <![endif]-->\n";
        /*
  $output .= "          <!--[if gte IE 5]>\n";
  $output .= "          <style type=\"text/css\" media=\"screen\" 
title=\"Oratorij default\">@import url(\"${themepath}ie.css\");</style>\n";
  $output .= "          <script src=\"${themepath}ie.js\" 
type=\"text/javascript\"></script>\n";
  $output .= "          <![endif]-->\n";
        */
  $output .= "  </head>\n";
  $output .= "  <body>\n";

  $output .= "  <!-- flicker fix for compliance patch for microsoft browsers 
-->\n";
  $output .= "  <!--[if lt IE 7]>\n";
  $output .= "          <script 
type=\"text/javascript\">if(window.IE7)document.body.style.visibility='hidden';</script>\n";
        $output .= "    <![endif]-->\n";

  $output .= "          <div id=\"header\" style=\"background: 
url('$bgpics[$e]') top right;\"><a href=\"$GLOBALS[base_url]\"></a><h6 
class=\"hidden\">Oratorij</h6></div>\n";
  $output .= "          <hr class=\"hidden\"/>\n";
  $output .= "          <div id=\"content\">\n";
  $output .= "                  <div id=\"main\">\n";
  $output .= "                          $breadcrumb\n";
  $output .= "                          $tabs\n";
  $output .= "                          $help\n";
  $output .= "                          $content\n";
  $output .= "                  </div>\n";
  $output .= "                  <hr class=\"hidden\"/>\n";
  $output .= "                  <div id=\"c1\">\n";
  $output .= "                          $blocks_left\n";
  $output .= "                  </div>\n";
  $output .= "                  <div id=\"c2\">\n";
  $output .= "                          $blocks_right\n";
  $output .= "                  </div>\n";
  $output .= "          </div>\n";
  $output .= "          <hr class=\"hidden\"/>\n";
  $output .= "          <div id=\"footer\"></div>\n";
  $output .= "          $themeclose\n";
  $output .= "  </body>\n";
  $output .= "</html>\n";



        # Fix the image sizes for everyone
        if (strstr($_SERVER['REQUEST_URI'], "node") || 
strstr($_SERVER['REQUEST_URI'], "node/edit")) {
                # Normal size -
                $output = 
preg_replace('/(<div\s+?class=["\']image["\'].*?<img\s+?.*?files\/images\/.[^"\']*?)((.jpg|.png|.gif|.JPG|.PNG|.GIF)["\']?)(\s+.[^>]*?>)/s',"$1.preview$2/>",$output);
                $output = 
preg_replace('/(<div\s+?class=["\']image-.*?<img\s+?.*?files\/images\/.[^"\']*?)((.jpg|.png|.gif|.JPG|.PNG|.GIF)["\']?)(\s+.[^>]*?>)/s',"$1.halfsize$2/>",$output);
        } else {
        $output = 
preg_replace('/(<img\s+?[^>]*?\s?)src=(["\'])(files\/images\/.[^"\']*?)((.jpg|.png|.gif|.JPG|.PNG|.GIF)["\']?)(\s+.[^>]*?>)/',
 "$1src=$2$3.thumbnail$4$5", $output);
        }

        return($output);
}






function oratorij_node($node, $main = 0, $page = 0) {

  global $user;

        if ($node->teaser == "n/a") {} else {

  $output .='<div class="node '. $node->type .'">' ."\n";

  // Tale if stavek je zato, da 'page' nima datuma in takih zadev
  if (!$page) {
    $output .= '<h2>'. ($main ? l($node->title, "node/$node->nid") : 
$node->title) .'</h2>';
  } else {
    $output .= "<h1>$node->title</h1>";
  }

        #### Date of post...
        if ($node->type != page) {
    $postdate = theme_get_setting("toggle_node_info_$node->type") ? array(t("By 
%author at %date", array('%author' => format_name($node), '%date' => 
format_date($node->created, 'tiny')))) : array();

  }
        $output .= "<sub>".$postdate[0]."</sub>";


        #### Start body
        $output .= " <div class=\"body\">\n";

  if ($main && $node->teaser && !$page) {
    $output .= $node->teaser;
  }
  else {
    $output .= $node->body;
  }
  $output .= " </div>\n";


  // Generiraj linke na koncu
  $terms = array();
  if (module_exist('taxonomy')) {
    $terms = taxonomy_link("taxonomy terms", $node);
  }

  if ($node->links) {
#    $output .= " <div class=\"links\">". theme('links', 
array_merge($submitted, $terms, $node->links)) ."</div>\n";
    $output .= " <div class=\"links\">". theme('links', array_merge($terms, 
$node->links)) ."</div>\n";
  }

  $output .= "</div>\n";


        } # zaklju;ek od prvega ifa.

        # Yaaradi nesre;nih OG moramo popraviti URLje thumbnailov tukaj:
        if ( $node->type == "og" ) {
        $output = 
preg_replace('/(<img\s+?[^>]*?\s?)src=(["\'])(files\/images\/.[^"\']*?)((.jpg|.png|.gif|.JPG|.PNG|.GIF)["\']?)(\s+.[^>]*?>)/',
 "$1src=$2$3.thumbnail$4$5", $output);
        }

  return $output;
}


/* Normal block */
function oratorij_block($block) {
        $themepath = "$GLOBALS[base_url]/themes/oratorij/";
        $bgpics = array(
                                                        
"${themepath}pic/ie/blockbgl1-trans.png",
                                                        
"${themepath}pic/ie/blockbgl2-trans.png",
                                                        
"${themepath}pic/ie/blockbgl3-trans.png",
                                                        
"${themepath}pic/ie/blockbgl4-trans.png",
                                                        
"${themepath}pic/ie/blockbgl5-trans.png",
                                                        
"${themepath}pic/ie/blockbgl6-trans.png"
                                                );

                $i = strlen($block->module).$block->delta;
                $e = 0;
                while ( $i > -1) {
                        if ($e > count($bgpics) ) {
                                $e = 0;
                        }       else {
                                $e++;
                        }
                        $i--;
                }

        global $user; # Naslednji IF in tale sta povezana, ker ne maramo 
navigacije za neprijavljene.
        if (!$user->name && $block->delta=="1") {} else {
                $output  = "<div class=\"block block-$block->module\" 
id=\"block-$block->module-$block->delta\">\n";
        $output .= "<h3 class=\"title\" style=\"background: 
url('$bgpics[$e]');\">$block->subject</h3>\n";
        $output .= " <div class=\"body\">$block->content</div>\n";
        $output .= "</div>\n";
        }
  return $output;
}



/* Image in block title
function oratorij_block($block) {
  $output  = "<div class=\"block block-$block->module\" 
id=\"block-$block->module-$block->delta\">\n";
  $output .= "<h3 class=\"title\" style=\"height: 24px; width: 100%; 
background: url('themes/oratorij/txtpic.php?t=$block->subject&amp;ending=.png') 
top left no-repeat\"><span class=\"hidden\">$block->subject</span></h3>\n";
  $output .= " <div class=\"body\">$block->content</div>\n";
  $output .= "</div>\n";
  return $output;
}
 */


function oratorij_event_upcoming_list($links) {
  global $user;

  if (is_array($links) && (sizeof($links) > 0)) {
    foreach ($links as $node) {
      $starttime = $node->start;
      if (variable_get('event_timezone', '1')) {
        $starttime -= $user->timezone;
      }
      else {
        $timezone = variable_get('date_default_timezone', 0);
        $starttime -= $timezone;
      }

      $minutesleft = floor(($starttime - time()) / 60);

      if ($minutesleft < 0) {
        $timeleft = t('NOW');
      }
      else if ($minutesleft < 60) {
        $timeleft = format_plural($minutesleft, '1 minute', '%count minutes');
      }
      else if ($minutesleft >= 60 && $minutesleft < (24*60)) {
        $timeleft = format_plural(floor($minutesleft/60), '1 hour', '%count 
hours');
      }
      else if ($minutesleft >= (24*60)) {
        $timeleft = format_plural(floor($minutesleft/(24*60)), '1 day', '%count 
days');
      }

      $items[] = "<h4>".l($node->title, "node/$node->nid", array("title" => 
$node->title)) . "</h4>".check_output($node->teaser, 
$node->format)."<em>($timeleft)</em>";

      /* BEGIN: Tonijev hack */
          /* Ker je anonimen user dobil dvojne dogodke v bloku se enega znebimo 
*/
      if (end($items) == prev($items)) {
        array_pop($items);
      }
      /* END: Tonijev hack */
    }
    return theme("item_list", $items);
  }
}


function oratorij_image_gallery($galleries, $images) {
  // We'll add height to keep thumbnails lined up.
  list($width, $height) = _image_get_dimensions('thumbnail');

  $content = '';
  if (count($galleries)) {
    $content.= '<ul class="galleries">';
    foreach ($galleries as $gallery) {
      $content .= '<li style="height : '.$height .'px">';
      $content.= l(image_display($gallery->latest, 'thumbnail'), 
'image/tid/'.$gallery->tid, array(), NULL, NULL, FALSE, TRUE);
      $content.= "<h3>".l($gallery->name, 'image/tid/'.$gallery->tid) . 
"</h3>\n";
      $content.= '<div class="description">'. 
check_output($gallery->description) ."</div>\n";
      $content.= '<p class="count">' . format_plural($gallery->count, 'There is 
%count image in this gallery', 'There are %count images in this gallery') . 
"</p>\n";
      if ($gallery->latest->changed) {
        $content.= '<p class="last">'. t('Last updated: %date', array('%date' 
=> format_date($gallery->latest->changed))) . "</p>\n";
      }
      $content.= "</li>\n";
    }
    $content.= "</ul>\n";
  }

  if (count($images)) {
    $height += 75;
    $content.= '<ul class="images">';
    foreach ($images as $image) {
      $content .= '<li';
      if ($image->sticky) {
        $content .= ' class="sticky"';
      }
      #$content .= ' style="height : '.$height .'px; width : '.$width.'px;"';
      $content .= ' style="height : '.$height .'px;"';
      $content .= ">\n";
      $content .= l(image_display($image, 'thumbnail'), 'node/'.$image->nid, 
array(), NULL, NULL, FALSE, TRUE);
      $content .= '<h3>'.l($image->title, 'node/'.$image->nid)."</h3>";
      ## $content .= '<div class="author">'. t('Posted by: %name', 
array('%name' => format_name($image))) . "</div>\n";
      $content .= '<div class="date">'.format_date($image->created)."</div>\n";
      $content .= "</li>\n";
    }
    $content.= "</ul>\n";
  }

  if ($pager = theme('pager', NULL, 6, 0)) {
    $content.= $pager;
  }

  return $content;
}

Reply via email to