PDA

View Full Version : CMS Articles Forum Block


Thr33
09-19-2012, 11:36 PM
My current code.
<vb:each from="articles" key="articleid" value="article">
<div class="article-block">
&bull; <a href="{vb:raw article.url}"><b>{vb:raw article.title}</b></a> by {vb:raw article.lastposter}
<div style="padding: 0px 0px 2px 14px;"><img src='images/literecords/misc/view-icon.png' alt='' class='inlineimg' /> {vb:raw article.replycount} comments</div></div>
</vb:each>

Ive been looking round to try and find the variable to show the view count, with no luck. Ive tried:
{vb:raw article.viewcount}
{vb:raw viewcount}
{vb:rawphrase article.viewcount}

Any help?

Lynne
09-20-2012, 12:09 AM
This is template code for a forum block? What is the PHP code you are adding to the php block?

Thr33
09-20-2012, 02:16 PM
Yeah this is the template code that is now the CMS forum block. I can get it to show the article.title and article.replycount but I can't find how to display the article.viewcount.

Lynne
09-20-2012, 02:49 PM
I am still unclear on the php code you are using, but whatever it is, you need to make sure the variable is defined in there and then pre-registered for use in that template.

Thr33
09-20-2012, 07:11 PM
This being said, how come the {vb:raw article.replycount}, {vb:raw article.url} and {vb:raw article.title} are working?

In the new forum block (cms_block) I am able to call the 3 above variables but not {vb:raw article.viewcount}. This is problem. I've not added any php code within the basic forum block form, I have edited the template itself and just enabled the new edited CMS forum block.

Lynne
09-20-2012, 09:05 PM
It's not defined in /includes/block/cmsarticles.php to be used in the template. You need to modify that code to be able to use that variable.

Thr33
09-20-2012, 09:18 PM
Could you suggest how i could modify my code to be able to call that function from the articles template?

Lynne
09-21-2012, 12:04 AM
Your code? So you do have some code you added?

If you are asking about the default vbulletin code, you just need to add a new variable for it around lines 188-200. If you use $row['something'] as your variable, you shouldn't have to register it.