The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
VBCMS Plugin Woes
Hi Team,
I'm trying to write a plugin that will affect each of the articles on the VBCMS home. I want to evaluate something for each article, and if i find what I am looking for, I want to show some text or an image on that specific preview. So, I've run into some issues: 1) I cannot even get anything from a plugin to show in the "vbcms_content_article_preview" template. None of the vbcms_xxxx hooks worked, so i even tried global_start (which im using for similar logic in navbar template), which still doesnt work. Here's my test code: Hook: global_start Code: $testme = "abc123cba"; vB_Template:reRegister('vbcms_content_article_pr eview',array('testme' => $testme)); inside my vbcms_content_article_preview template, i have: :{vb:raw testme}: All I see is "::", the variable doesnt show. ---------------------------------------------------------- 2) I want to process my logic for EACH article on the page. So I need a hook that gets fired multiple times, and allows me to send output to the template in question for each iteration. I have paid support over at vbulletin.com, but they sent me over here anyways, as youse guys are the bomb. ---------------------------------------------------------- An example of this plugin, might be to show a small graphic for new articles, vs articles over a week old, vs articles over a month old. Please give a hand, as Im ripping out what little hair i have left!! |
#2
|
||||
|
||||
If you're just doing it on the preview, try this:
Hook name: vbcms_article_populate_end PHP Code:
|
#3
|
|||
|
|||
Quote:
Excellent! That works. Now, the next question. How do i find the node-id for the current article iteration? I believe that it is piece i am still missing. |
#4
|
||||
|
||||
PHP Code:
|
#5
|
||||
|
||||
(global_start is deprecated - do a search in your files and you will see this. So, it is not evaled at all in the CMS pages.)
|
#6
|
|||
|
|||
Quote:
This was the best way to do it and still remain non-intrusive. --------------- Added [DATE]1311123733[/DATE] at [TIME]1311123733[/TIME] --------------- AH! Makes sense. Wish the support rep I had on the phone earlier told me that. He just agreed it should work, and sent me here. |
#7
|
||||
|
||||
You're talking about default, vBulletin tags? You'll actually need the contenttypeid/contentid, not the nodeid.
PHP Code:
|
#8
|
|||
|
|||
Quote:
|
#9
|
||||
|
||||
Not sure if one way is more "proper" than the other, but here's what you're looking at...
PHP Code:
|
#10
|
||||
|
||||
For future referance :
If you want to get nodeId of all articles on that page then create a plugin at hook : vbcms_article_populate_start And then below will get you nodeId of each article : $this->content->getNodeId() Note that it is content->getNodeId() and not node->getNodeId(). Cheers! Aditya Hajare P.S. I'm assuming you know all about pre-registering vars to templates etc. etc. Thats why i'm not writing this in details. But if you want sample code then lemme know. Cheers! |
Благодарность от: | ||
Lynne |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|