Recent Topics

[Hack] Display item titles

Started by on Feb 02, 2007 – Contents updated: Feb 02, 2007

Feb 02, 2007 17:45    

In the http://manual.b2evolution.net/Main.php_file Docs I found this piece of code:

<?php 
     $TOPART = new ItemList($blog, array(), '', '', -1, '', array(), '', 'DESC', 'views', 4); 
     echo "<ul>"; 
     while ($TOPART_ITEM = $TOPART->get_item()) { 
     echo "<li><a href=\"", $TOPART_ITEM->get_permanent_url(); 
     echo "\">", $TOPART_ITEM->title('','',false), "</a>"; 
     } 
     echo "</ul>"; 
 ?> 


and I was wondering what the values are for where now 'views' is inserted. I can't find the source of the code in the distro. Pointing out in wich php file it is might help me also.

Feb 03, 2007 07:25

$Item->views();

will display the views.

imho your better off using the technical docs at http://doc.b2evolution.net if you want to find out how what stuff you can use. Or the best way would just be to look at how your skin (or another skin) does it.

Mar 22, 2007 11:01

Hmm, couldn´t get it working... always returns Fatal error: Call to a member function on a non-object ...

Where exactly I have to insert

$Item->views();

in the TOP-List hack?

Mar 22, 2007 16:28

You need to use $TOPART_ITEM->views(); ;)

¥

Mar 22, 2007 20:17

Ok... right, but this returns "xxx views"; how can I just return the number of views as simple number?

Mar 23, 2007 07:52

echo $TOPART_ITEM->views;

;)

¥

Mar 23, 2007 13:36

Perfect; thanks again!!!


Form is loading...

b2evolution CMS – This forum is powered by b2evolution CMS, a complete engine for your website.