PDA

View Full Version : Add a new Block with PHP content?


mokujin
23 Dec 2009, 21:53
hello,
I just tried to add a new block (Forum Blocks Manager) with PHP content type but there is always error.
just tried:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Lynne
23 Dec 2009, 22:29
And the error is?

ragtek
24 Dec 2009, 02:25
Is this the only code you're using?
That wount work;)

1. You have to use vB::$db-> instead of $vbulletin->db
2. You'll need to fetch the query.
3. You'll need to add the results to an array or to a template
4. You'll need to return it

mokujin
09 Jan 2010, 18:39
Is this the only code you're using?
That wount work;)

1. You have to use vB::$db-> instead of $vbulletin->db
2. You'll need to fetch the query.
3. You'll need to add the results to an array or to a template
4. You'll need to return it
Can you please give me an example? Thank you

Lynne
09 Jan 2010, 18:51
If you want to see an example, here's a real simple block that just spits out the user's username:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Dunhamzzz
12 Jan 2010, 09:52
I've done things in a slightly different way....

I was making widget (not sure how these differ from sidebar blocks)

But I made completely blank template, with just {vb:raw output} in it, and in my php area just include() an external file and have the out stored in $output.

Means I can edit the included file however I want, and I can re-use that template too.