Results 1 to 4 of 4

Thread: Fatal error: Call to undefined function

  1. #1

    Thread Starter
    Hyperactive Member Animelion's Avatar
    Join Date
    Jan 2001
    Location
    Jacksonville NC
    Posts
    283

    Fatal error: Call to undefined function

    I'm modifying a Drupal template and keep having a problem with this.

    ERROR
    Fatal error: Call to undefined function: marinelli_width() in /home/content/b/.../html/themes/marinelli/page.tpl.php on line 80

    page.tpl.php (Line 80)
    Code:
      <div id="primary" style=<?php print '"width:'.marinelli_width( $left, $right).'px;">' ?>
    template.php
    Code:
    function marinelli_width($left, $right) {
      $width = 340;
      if (!$left ) {
        $width = $width +190;
      }  
      
       if (!$right) {
        $width = $width +190;
      }
      return $width;
    }
    ~ Animelion

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Fatal error: Call to undefined function

    did you include the template.php into your tpl page?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Hyperactive Member Animelion's Avatar
    Join Date
    Jan 2001
    Location
    Jacksonville NC
    Posts
    283

    Re: Fatal error: Call to undefined function

    I don't understand the question, so here is the full page.tpl.php

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head>
      <title><?php print $head_title ?></title>
      <?php print $head ?>
      <?php print $styles ?>
      <?php print $scripts ?>
    </head>
    
    
    <body>
    <div id="title">
    	<?php if ($site_name) : ?>
    		<h1 class="sitetitle">
    			<a href="<?php print $base_path ?>" title="<?php print t('Home') ?>">
    				<?php print $site_name ?>
    			</a>
    	    </h1>
    	<?php endif; ?>
    	
    	<?php if ($site_slogan){?>
    		<h2><?php print $site_slogan ?></h2>
    	<?php } ?>
    </div>
    
    
    
    <div id="page">
    
      <div id="header">
    
    
      	  <div id="utilities">
    		<?php print $search_box ?>
    		
    		<?php if (isset($primary_links)) : ?>
    			<?php print '<div id="plinks">'; ?>
    				<?php print theme('links', $primary_links, array('class' => 'links primary-links')) ?>
    			<?php print '</div>'; ?>
    		<?php endif; ?>
    	  </div>
    	  
      </div>
      
    
    
     
             <?php if (($secondary_links)) : ?>
          <?php print '<div id="submenu">' ?>
              <?php print theme('links', $secondary_links, array('class' => 'links secondary-links')) ?>
              <?php print '</div><div class="stopfloat"></div>' ?>
            <?php endif; ?>
    
           
       
       
               	<!-- left -->
            <?php if ($left) { ?>
              <div class="lsidebar">
    
              
                <?php print $left ?>
                
              </div><!-- end left -->
            <?php } ?>
    
       	<!-- right -->
            <?php if ($right) { ?>
              <div class="rsidebar">
     
                <?php print $right ?>
             
              </div><!-- end right -->
            <?php } ?>
    
      <div class="content">
      
      
       <div id="primary" style=<?php print '"width:'.marinelli_width( $left, $right).'px;">' ?>
                   <div class="singlepage">
    	  <?php print $breadcrumb; ?> 
    	  
    
             <?php if ($title): print '<h2'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .'</h2>'; endif; ?>
              <?php if ($tabs): print '<div class="tabs">'.$tabs.'</div>'; endif; ?>
            <?php if ($help) { ?><div class="help"><?php print $help ?></div><?php } ?>
              <?php if ($messages) { ?><div class="messages"><?php print $messages ?></div><?php } ?>
    		  
    		  <?php print $content ?>
    <div class="drdot">
    <hr />
    </div>
             
              
     
          </div>
          <hr />
        </div>
    
        <hr />
       
       
       
    
    
    
    
     <div class="clear"></div>
    
      </div>
      <br class="clear" />
    </div>
    <!-- Close Page -->
    <hr />
    <div id="footer">
    <?php print $footer ?>
    <?php print $footer_message ?>
    </div>
    <?php print $closure ?>
    </body>
    </html>
    and the full template.php
    Code:
    <?php
    //template for Marinelli Theme
    //author: singalkuppe - www.signalkuppe.com
    
    
    
    
    function marinelli_width($left, $right) {
      $width = 340;
      if (!$left ) {
        $width = $width +190;
      }  
      
       if (!$right) {
        $width = $width +190;
      }
      return $width;
    }
    
    
    
    /**
     * Return a themed breadcrumb trail.
     *
     * @param $breadcrumb
     *   An array containing the breadcrumb links.
     * @return a string containing the breadcrumb output.
     */
    function phptemplate_breadcrumb($breadcrumb) {
      if (!empty($breadcrumb)) {
          $breadcrumb[] = drupal_get_title();
            array_shift($breadcrumb);
           return '<div class="path"><p><span>'.t('You are here').'</span>'. implode(' / ', $breadcrumb) .'</p></div>';
      }
      }
    
    
    //overrides taxonomy term page function
    function marinelli_taxonomy_term_page($tids, $result) {
      drupal_add_css(drupal_get_path('module', 'taxonomy') .'/taxonomy.css');
    
      $output = '';
    
      // Only display the description if we have a single term, to avoid clutter and confusion.
      if (count($tids) == 1) {
        $term = taxonomy_get_term($tids[0]);
        $description = $term->description;
    
        // Check that a description is set.
        if (!empty($description)) {
          $output .= '<div class="terminfo"><p>';
          $output .= filter_xss_admin($description);
          $output .= '</p></div>';
        }
      }
    
      $output .= taxonomy_render_nodes($result);
    
      return $output;
    }
    
    
    
    
    
    function marinelli_admin_page($blocks) {
      $stripe = 0;
      $container = array();
    
      foreach ($blocks as $block) {
        if ($block_output = theme('admin_block', $block)) {
          if (empty($block['position'])) {
            // perform automatic striping.
            $block['position'] = ++$stripe % 2 ? 'left' : 'right';
          }
          if (!isset($container[$block['position']])) {
            $container[$block['position']] = '';
          }
          $container[$block['position']] .= $block_output;
        }
      }
    
      $output = '<div class="admin clear-block">';
      $output .= '<div class="compact-link"><p>'; // use <p> for hide/show anchor
      if (system_admin_compact_mode()) {
        $output .= l(t('Show descriptions'), 'admin/compact/off', array('title' => t('Expand layout to include descriptions.')));
      }
      else {
        $output .= l(t('Hide descriptions'), 'admin/compact/on', array('title' => t('Compress layout by hiding descriptions.')));
      }
      $output .= '</p></div>';
    
      foreach ($container as $id => $data) {
        $output .= '<div class="'. $id .' clear-block">';
        $output .= $data;
        $output .= '</div>';
      }
      $output .= '</div>';
      return $output;
    }
    
    function marinelli_admin_block_content($content) {
      if (!$content) {
        return '';
      }
    
      if (system_admin_compact_mode()) {
        $output = '<dl class="menu">';
        foreach ($content as $item) {
          $output .= '<dt>'. l($item['title'], $item['href'], $item['localized_options']) .'</dt>'; // use definition list per compact mode
        }
        $output .= '</dl>';
      }
      else {
        $output = '<dl class="admin-list">';
        foreach ($content as $item) {
          $output .= '<dt>'. l($item['title'], $item['href'], $item['localized_options']) .'</dt>';
          $output .= '<dd>'. $item['description'] .'</dd>';
        }
        $output .= '</dl>';
      }
      return $output;
    }
    
    function marinelli_system_admin_by_module($menu_items) { // admin by module page
      $stripe = 0;
      $output = '';
      $container = array('left' => '', 'right' => '');
      $flip = array('left' => 'right', 'right' => 'left');
      $position = 'left';
    
      // Iterate over all modules
      foreach ($menu_items as $module => $block) {
        list($description, $items) = $block;
    
        // Output links
        if (count($items)) {
          $block = array();
          $block['title'] = $module;
          $block['content'] = theme('item_list', $items);
          $block['description'] = t($description);
    
          if ($block_output = theme('admin_block', $block)) {
            if (!isset($block['position'])) {
              // Perform automatic striping.
              $block['position'] = $position;
              $position = $flip[$position];
            }
            $container[$block['position']] .= $block_output;
          }
        }
      }
    
      $output = '<div class="bymodule">';
      foreach ($container as $id => $data) {
        $output .= '<div class="'. $id .' clear-block">';
        $output .= $data;
        $output .= '</div>';
      }
      $output .= '</div>';
    
      return $output;
    }
    ~ Animelion

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Fatal error: Call to undefined function

    page.tpl.php doesn't know anything about template.php. You have to include it into the page.
    Code:
    <?php include "template.php" ?>
    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width