If you switch the template names (just for a test), does it still only work in the navbar?
|
1 Attachment(s)
Still not working, here is the complete code in use atm...
(code removed :)) |
Quote:
|
Quote:
|
i need help parsing a code into HEADER template using plugin
basically i need to insert a code after Code:
<div id="toplinks" class="toplinks"> using something like Code:
|
Try this in the parse_templates hook:
Code:
require_once(DIR . '/includes/class_template_parser.php'); |
Quote:
I thank you very much it worked 100% :) updating templates this way works perfect without the need to go into the template to manually input it thx |
Quote:
|
Quote:
many thanks |
Quote:
|
Quote:
|
Go for it. An unnamed dev gave it to me a long while back.
|
Hey all,
I think i'm being really dumb here, looking for some help. In my Navbar Template i want to call another template that i want to create, rather that adding code irectly into the navbar template. Am i right in thinking that i have to register the code in a php file on the server, or can i do this all via a plug in and templates? if so, does anyone have some code for a simple example, i.e. call 1 new template from within another VB default template? - I ask because unless i am mistaken what i've read thus far seems to focus more on adding code to PHP files. Currently running 4.1.10. The template I want to call from navbar template is called memberbar_basic. |
Quote:
Code:
$templater = vB_Template::create('memberbar_basic'); and you would put {vb:raw memberbar_basic} in the navber template. Hook location parse_templates would probably be a good place for your plugin. |
Hiya,
Thanks for responding - I can't seem to get it to work though, let me review whats currently configured. Template = memberbar_member_basic Template content = memberbar member basic test. Plugin name = memberbar_member_basic Plugin Hook = Parse Templates Plugin Content = PHP Code:
I tried moving {vb:raw memberbar_member_basic} to other templates, specifically forumhome but its still not rendering. would i have to use variables? if so, is there a guide/overview of what variables would bee needed anywhere? Thanks B |
Off hand there's a typo in the middle line, it's missing the first "m" in "memberbar"
If that error is in your real code it wouldn't work. |
haha, now i do really feel stupid....
ok, modified my thread correcting the typo and im please to say its working!.. /grabs coat.. (p.s. thank you!) --------------- Added [DATE]1330432890[/DATE] at [TIME]1330432890[/TIME] --------------- --------------- Added [DATE]1330432974[/DATE] at [TIME]1330432974[/TIME] --------------- Progressing from my previous query. I need to register some variables to allow notifications to be registered in my plugin (Post # 216) I've tried following this guide here.. https://www.vbulletin.com/forum/show...ons-menu-place I attempted the following, to no avail. Plugin name = memberbar_member_basic Plugin Hook = Parse Templates Plugin Content = PHP Code:
Code moved. PHP Code:
Thanks B |
Progressing from my previous query.
I need to register some variables to allow notifications to be registered in my plugin (Post # 216) I've tried following this guide here.. https://www.vbulletin.com/forum/show...ons-menu-place I attempted the following, to no avail. Plugin name = memberbar_member_basic Plugin Hook = Parse Templates Plugin Content = PHP Code:
Code moved. PHP Code:
Thanks B |
OK, I have done.
|
PHP Code:
PHP Code:
PHP Code:
|
Well, obviously $statar is an array. I have no idea how you set it up, but just as you can't do echo $array in PHP, you can't just use {vb:raw array}. In PHP you would do echo $array['key'] to output the value. In the template you need to use {vb:raw array.key} accordingly.
Just as described in the first chapter of the article. |
Appreciate it Cellarius.
I looked through some of the other vbulletin, so I had to do something like. while yada yada { something = something['']} And everything started working. Mental error on my part. The only thing now is trying to complete a new mod for vbulletin. |
If anyone is able to guide me, I am trying to hack the Post Thanks Plugin so I can pass a variable to a template as a conditional.
Here is the function I need to create a conditional for: PHP Code:
HTML Code:
<vb:if condition="$post['can_thank_post']">Button code here</vb:if> |
LW (linkworth ) has given me a php file to include in the navigation bar. It will show rotating ads via rss feed. How can I include that file
I wrote the following code in global_start PHP Code:
Also the code in the rss_reader.php is : PHP Code:
|
I'm just curious if registering the navbar is always necessary if you're creating a template for your own vB page, and if so, should the first post be updated to illustrate this?
And where the hell is the documentation on things like this: Quote:
|
You won't stumble on to that anywhere in the files. ;)
|
Pls help me :(
https://vborg.vbsupport.ru/showthread.php?t=282142 |
If I have this:
PHP Code:
Code:
{vb:raw my_array} Code:
Array |
{vb:raw my_array.0} = 1
{vb:raw my_array.1} = 2 |
Quote:
PHP Code:
Quote:
|
Oh, and is there any way to show all my array cells If I don't know which size is the array?
Edited: I suspect that it is done in this way. Code:
<vb:each from="my_array" key="key1" value="my_result"> resource(46) of type (mysql result) And each row is: Code:
array(21) { ["id"]=> string(2) "18" ["name"]=> string(5) "ABRIR" ["description"]=> string(23) "Iniciar la interacci?n." ["userid"]=> string(4) "2858" ["username"]=> string(20) "Seducci?n Cient?fica" ["dateline"]=> string(10) "1311875182" ["lastupdate"]=> string(10) "1311933838" ["categoryid"]=> string(1) "1" ["status"]=> string(1) "1" ["ipaddress"]=> string(13) "81.202.205.41" ["attach"]=> string(1) "0" ["threadid"]=> string(1) "0" ["lastupdater"]=> string(20) "Seducci?n Cient?fica" ["lastupdaterid"]=> string(4) "2858" ["tags"]=> string(16) "abrir,escalada 1" ["popup"]=> string(23) "Iniciar la interacci?n." ["views"]=> string(1) "0" ["votenum"]=> string(1) "0" ["votetotal"]=> string(1) "0" ["linkurl"]=> string(7) "http://" ["banner"]=> string(7) "http://" } Code:
<vb:each from="my_query" value="sentence"> But It doesn't show nothing, as if the each is not being executed. I expected to show, at least, 46 Test words. |
Quote:
You are registering the return from one of the query functions. You need to call fetch_array() to get an array for each row, like: Code:
$results = $db->query_read("some sql"); Of course each row is an array (even if you only selected one column). If you are selecting one column from a number of matching rows, you won't get an array with all the matching values, you still get an array for each row. If you want an array with all the matching values you'd have to build that yourself. Note also that you don't *have* to register an array to your template and use vb:each - you could format your own html string in the while loop above, then just register the string. |
[QUOTE=Boofo;2287132]Try this in the parse_templates hook:
Boofo, I was working on specialized routine and trying to use some of the vb-ojects to solve my problem when I came across the code you posted here. This redirected me to the right vb routines. Thanks so much for sharing! |
I have a problem on a page. I can use the variable {vb:raw companyname} in the places of the template that I need to. However when I want to place it in my navbits which are created by the php file it just echos itself.
Code:
$navbits = construct_navbits(array('' => ' </span></li><li class="navbit"><span><a href="/">Home</a></span></li><li class="navbit"><span><a href="../hostindex.php">Web Hosting</a></span></li><li class="navbit lastnavbit"><span>{vb:raw companyname} |
Try putting $companyname in your navbits instead of {vb:raw companyname} Since it's in a single-quoted string you need to use concatenation, like:
Code:
$navbits = construct_navbits(array('' => ' </span></li><li class="navbit"><span> |
Quote:
|
Can anyone help me out what i'm doing wrong?
i'm trying to add something to the Default navbar template. (a server status for my game server) but first i'm trying out the example but i can't get it to work. This is my plugin setup. Product : vBulletin Hook location: Global_start Title: server Status execution order :5 Plugin code: Code:
/* Some Code, setting variables, (multidimensional) array */ Code:
{vb:raw my_var} Code:
<p>{vb:raw my_var}</p> Edit: and Enable Plugin/Hook System is enabled also |
You don't want to render the navbar template because the vbulletin code already does that for you. To get your variable registered to that template you want to use preRegister, like;
Code:
$my_var = "abc"; |
Thanks a lot. :up:
Now i can start creating my plugin understanding the preRegister. |
Quote:
I'm doing this using $GLOBALS[templatevalues] = $templatevalues; rather than preRegister(). Code:
$templater = vB_Template::create('layout_start'); Then use this in the templates where you want the output to appear: Code:
{vb:raw GLOBALS.templatevalues.start_insertvar} |
All times are GMT. The time now is 12:05 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|