vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Side Blocks (https://vborg.vbsupport.ru/showthread.php?t=257501)

Mastar 01-21-2011 12:27 AM

Side Blocks
 
How can I get in the sideblock using something like:

PHP Code:

{vb:raw post.username

Actually I would like to get the forum leaders avatar, username and a profile field to appear in the sideblock!

Lynne 01-21-2011 01:09 AM

You would need to write a php block and put in the code to output what you want.

Mastar 01-21-2011 02:42 AM

Do you know where can I find a sample or something I can reference from?

Lynne 01-21-2011 02:46 AM

There are a few blocks modifications in the mods forums. So, go download a couple of those and check out the code.

Mastar 01-21-2011 07:07 AM

I've searched but didn't locate any, can you point me to one plz!

Lynne 01-21-2011 02:35 PM

There are several.
https://vborg.vbsupport.ru/forumdisp...c&daysprune=-1
https://vborg.vbsupport.ru/forumdisp...c&daysprune=-1

Mastar 01-21-2011 04:51 PM

I know how to add the content in the sideblocks but I don't know how to get the vbulletin var to get the content there, if I just put {vb:raw post.username} to show the person's username it show just {vb:raw post.username} it doesn't render the actual username.

Lynne 01-21-2011 05:38 PM

First off, you need to define the variable $post to use it in the block.

But, besides that, variables are not html. You would need to create a PHP block to output a variable and there is an example there on how to do output in a php block:
Code:

$my_output = 'Hello, world.';
return $my_output;

An example using a variable:
Code:

$my_output = '<p>Hello '. vB::$vbulletin->userinfo[username].'</p>';
return $my_output;


Mastar 01-21-2011 05:49 PM

Do I need to put anything for the template used?

I tried that code and even the sample code that is there in the ACP, nothing in the template used area and the block didn't appear!

Thanks!

Lynne 01-21-2011 06:50 PM

You need a template for it to use. Just leave that as default block_html

http://www.vbulletin.com/forum/showt...10#post2105310

Mastar 01-21-2011 09:34 PM

I've copy and paste what you did there leaving the template block.html there set the type to php and nothing is coming up on the side. I'm thinking its vb 4.1.1 issues?

Lynne 01-21-2011 09:59 PM

No, it isn't a vb 4.1.1 issue because I tried that exact code I posted in a php block.

Please post your *exact* code and all the exact settings on the block page that you are creating.

Also, do you have blocks on in the first place? vboptions > forum sidebar > set those to what you want

Mastar 01-22-2011 12:27 AM

Title: TEST PHP
Content Type: PHP
Content:
PHP Code:

$my_output "Hello "vB::$vbulletin->userinfo['username'];
$my_output .= "<br />Your last post was in this thread:";
$myquery =  vB::$db->query_first("
        SELECT
            post.threadid, thread.title 
        FROM " 
TABLE_PREFIX "post AS post
        INNER JOIN " 
TABLE_PREFIX "thread AS thread ON (thread.threadid = post.threadid)
        WHERE post.userid = "
.vB::$vbulletin->userinfo['userid']. "
        ORDER BY post.dateline DESC
    "
);
$threadurl '<a href="' fetch_seo_url(thread$myquery) . '" title="'$myquery[title] .'">'$myquery[title] .'</a>';
$my_output .= "<br />" $threadurl;
return 
$my_output


Template to Use: block.html

Lynne 01-22-2011 12:51 AM

The template is not called block.html. It is block_html (as I said a few posts above and in the article I linked you to).

It works just fine for me if I have the correct template in that field.

Mastar 01-22-2011 07:03 AM

Thanks that was it!!!!

Appreciate it!

Special Pages 01-22-2011 12:28 PM

Haha thanks so much Lynne. I really appreciate your hard work! Please DO NOT delete this thread! I need it. :) lol thanks!


All times are GMT. The time now is 05:49 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
  • Page Generation 0.01167 seconds
  • Memory Usage 1,751KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (16)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete