Recent Topics

1 Oct 21, 2008 11:38    

My b2evolution Version: 1.10.x

I would like to display the number of views for each article in the article header, in the same way as it is displayed in the backoffice.

Any idea what code I need to insert ?

2 Oct 21, 2008 11:53

			<?php
				/* Old style item */
				// Output number of views
				echo ( '<li class="views">' );
				$Item->views();
				echo ( '</li>' );
			?>


I don't believe there's a 2.2.x equivalent of this.

Good luck

3 Oct 21, 2008 12:14

Works perfect !

Thanks :-)

4 Oct 28, 2008 11:33

in which file and where I should add this code?
I have 2.4.5 version

5 Oct 28, 2008 11:47

Hi stjep,

Depending on your skin this piece should go in /skins/YOUR_SKIN/index.main.php or /skins/YOUR_SKIN/_posts.main.php
If you open that file you will see a section with metadata (date, author etc). Place this piece there also. If you are not satisfied, the number of views should show up where youplce the snipped, so experiment a bit with it.

Godd luck

6 Nov 14, 2008 11:52

i have 2.4.5

i am using custom theme.
in the skins/custom/index.main.php



			<div class="bSmallHead">
			<?php
				// Permalink:
				$Item->permanent_link( array(
						'text' => '#icon#',
					) );

				$Item->issue_time( array(
						'before'    => ' ',
						'after'     => '',
					));

				$Item->author( array(
						'before'    => ', '.T_('by').' <strong>',
						'after'     => '</strong>',
					) );

				$Item->msgform_link();
				echo ', ';

				$Item->wordcount();
				echo ' '.T_('words');
				 echo ', ';
				 $Item->views();

				$Item->locale_flag( array(
						'before'    => ' &nbsp; ',
						'after'     => '',
					) );
			?>

delete the comments infront of

				 echo ', ';
				 $Item->views();

Then you can have number of views.


Form is loading...