The node author, and posting date/time don't show on front page in main content area... whether I use Story or some other content type doesn't seem to matter. Do I need to change a setting somewhere?
When I post content in the right sidebar, the author and posting info does appear, but it goes between the title and the content... is there a way to make it show after the content?

Comments

provod’s picture

same thing - I configured "display post information" via admin-building-themes-global settings, but no results on the front page

aharown07’s picture

Anybody got a theory on this one? I can probably find somebody to look at php or css or whatever if I had any idea what file to look at.

Lioz’s picture

take a look into the node template

int the homepage node are presented as teasers, so look into the if($teaser) condition and simply paste this code


  <div class="metanode"><p><?php print t('By ') .'<span class="author">'. theme('username', $node).'</span>' . t(' - Posted on ') . '<span class="date">'.format_date($node->created, 'custom', "d F Y").'</span>'; ?></p>  </div> 

aharown07’s picture

I don't actually "understand" PHP yet so.... can you give me a little more of the context so I can see better where to put it? ... or a line number?
Thanks!

aharown07’s picture

OK, I see several different <?php if (!$teaser): ?> places in the file... but only one <?php if ($teaser): ?>
Got a visible result with that (around line 30 in my file)
But it puts the post author and time at the end of the text instead of up under the title. Know how to change that?

aharown07’s picture

Got it! I don't know why this works, because I don't know PHP, but here's what I did...

Changed the <?php if (!$teaser): ?> at line 12 to <?php if ($teaser): ?> (removed the "!")
Added a "!" to the <?php if ($teaser): ?> around line 30... so it's now <?php if (!$teaser): ?>

Then I put Lioz's code above right after line 12.
The result was that the submission author/date/time info then appeared twice below the title.

Well, I'd noticed the same (or very similar) code already in the file after <?php if ($submitted): ?> at line 14.
So I added a "!" to that, changing it to <?php if (!$submitted): ?>

So far, that works.
What I surmised was that "!" is some kind of off switch. Am I close? Please tell me if I've broken anything important!

aharown07’s picture

Correction. What I did above broke the comments etc. line that is supposed to appear below the content.
After a good bit of trial and error, arrived at this... this is the code of the entire node.tpl.php file... can't remember now what exactly I did to it. But this displays both the submission info below the title and the comments info after the content.

   <?php if ($picture) {
      print $picture;
    }?>
    
  <div class="node<?php if ($sticky) { print " sticky"; } ?><?php if (!$status) { print " node-unpublished"; } ?>">

    <?php if ($page == 0) { ?><h2 class="nodeTitle"><a href="<?php print $node_url?>"><?php print $title?></a>
	<?php global $base_url;
	if ($sticky) { print '<img src="'.base_path(). path_to_theme().'/img/sticky.gif" alt="sticky icon" class="sticky" />'; } ?>
	</h2><?php }; ?>
    
	<?php if ($teaser): ?>
	<div class="metanode"><p><?php print t('By ') .'<span class="author">'. theme('username', $node).'</span>' . t(' - Posted on ') . '<span class="date">'.format_date($node->created, 'custom', "d F Y").'</span>'; ?></p>  </div>
	<?php if (!$submitted): ?>
      <div class="metanode"><p><?php print t('By ') .'<span class="author">'. theme('username', $node).'</span>' . t(' - Posted on ') . '<span class="date">'.format_date($node->created, 'custom', "d F Y").'</span>'; ?></p>
	  

	  
	  </div> 
    <?php endif; ?>
    <?php endif; ?>
    
    <div class="content"><?php print $content?></div>
    
    
    <?php if (!$teaser): ?>
    <?php if ($links) { ?><div class="links"><?php print $links?></div><?php }; ?>
    <?php endif; ?>
    
    <?php if ($teaser): ?>
    <?php if ($links) { ?><div class="linksteaser"><div class="links"><?php print $links?></div></div><?php }; ?>
    <?php endif; ?>
    
    
    <?php if (!$teaser): ?>
    <?php if ($terms) { ?><div class="taxonomy"><span>Tags</span> <?php print $terms?></div><?php } ?>
    <?php endif; ?>

    
  </div>
aharown07’s picture

Status: Active » Closed (fixed)
spangaroo’s picture

The solution in #7 works, but only brings the "metanode" info to the teaser. When viewing the full node, the author, date, and time aren't shown.

I'm on D6 and here's the code in my node.tpl.php file

  <div class="node<?php if ($sticky) { print " sticky"; } ?><?php if (!$status) { print " node-unpublished"; } ?>">
 	       <?php if ($picture) {
      print $picture;
    }?>
    

    <?php if ($page == 0) { ?><h2 class="nodeTitle"><a href="<?php print $node_url?>"><?php print $title?></a>
	<?php global $base_url;
	if ($sticky) { print '<img src="'.base_path(). drupal_get_path('theme','marinelli').'/img/sticky.gif" alt="'.t('sticky icon').'" class="sticky" />'; } ?>
	</h2><?php }; ?>
    	
	<?php if ($teaser): ?>
	<div class="metanode"><p><?php print t('By ') .'<span class="author">'. theme('username', $node).'</span>' . t(' - Posted on ') . '<span class="date">'.format_date($node->created, 'custom', "d F Y").'</span>'; ?></p></div>
	<?php if (!$submitted): ?>
    <div class="metanode"><p><?php print t('By ') .'<span class="author">'. theme('username', $node).'</span>' . t(' - Posted on ') . '<span class="date">'.format_date($node->created, 'custom', "d F Y").'</span>'; ?></p>
	  

	  
	  </div> 
    <?php endif; ?>
    <?php endif; ?>
    
    <div class="content">
	
	
	<?php print $content?></div>
    
    
    <?php if (!$teaser): ?>
    <?php if ($links) { ?><div class="links"><?php print $links?></div><?php }; ?>
    <?php endif; ?>
    
    <?php if ($teaser): ?>
    <?php if ($links) { ?><div class="linksteaser"><div class="links"><?php print $links?></div></div><?php }; ?>
    <?php endif; ?>
    
    
    <?php if (!$teaser): ?>
    <?php if ($terms) { ?><div class="taxonomy"><span><?php print t('Tags') ?></span> <?php print $terms?></div><?php } ?>
    <?php endif; ?>

    
  </div>

Does anyone know how to configure node.tpl.php so the node, author, and date appear on both the teaser and the full node?

Any help would be greatly appreciated. Cheers :)

ae860300’s picture

help ~
If you want the page to add last update time of the page how to implement?

print t('By ') .'<span class="author">'. theme('username', $node).'</span>' . t(' - Posted on ') . '<span class="date">'.format_date($node->created, 'custom', "d F Y").'</span>';

Just created-> changed Well?

drupal6.16

drasgroup’s picture

remove the conditional logic
like so

    <?php if (!$teaser): ?>  <------------------ bad
    <?php if ($terms) { ?><div class="taxonomy"><span>Tags</span> <?php print $terms?></div><?php } ?>
    <?php endif; ?>  <------------------ bad

becomes

    <?php if ($terms) { ?><div class="taxonomy"><span>Tags</span> <?php print $terms?></div><?php } ?>

afaict