Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-27-2015, 04:24 AM
Bastien's Avatar
Bastien Bastien is offline
 
Join Date: May 2015
Location: France
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Why do my var doesn't display in its template (sidebar) ?

I'm trying to integrate my chatbox to the sidebar on the forum

My bloc forum calls my template (which displays well
Chatbox [Archives]
output_template : $output)

my bloc content is :
Code:
$output='$output';
return $output;
and calls my template

If I put an echo $output in the forum.php file, it displays well at the top of the forum
But not in my template (whereas I put
Code:
{vb:raw output}
and declared the output var at then end of forum.php
Code:
$templater->register('output',$output);
I need help plizzz
Attached Images
File Type: jpg Capture.jpg (59.0 KB, 0 views)
Reply With Quote
  #2  
Old 06-27-2015, 10:50 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think your problem is this:
PHP Code:
$output='$output'
Since variables aren't evaluated in single quotes, you're setting the string to a literal $output. I don't think you need that line at all, just use return $output;
Reply With Quote
  #3  
Old 06-28-2015, 09:02 AM
Bastien's Avatar
Bastien Bastien is offline
 
Join Date: May 2015
Location: France
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If I don t add it, the bloc disent display at all I think ...
Reply With Quote
  #4  
Old 06-28-2015, 10:06 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not exacly sure what you're trying to do. Where does $output get set?
Reply With Quote
  #5  
Old 06-28-2015, 12:16 PM
Bastien's Avatar
Bastien Bastien is offline
 
Join Date: May 2015
Location: France
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
//affichage widget dans forum
// CHATBOX
// SIDE BOX POUR CHATBOX
	global $show;
	global $output;
	
	// Core
	require_once(DIR . '/mgc_cb_evo/classes/class_core.php');     
    $MGCCbEvoCore = new MGCCbEvo_core(vB::$vbulletin,vB::$vbulletin->userinfo['permissions']); 
    $MGCCbEvoCore->unserialize_user_params(); 
    
    if ($MGCCbEvoCore->show_chatbox() && $MGCCbEvoCore->evo_permissions->can_view())
    {
		$show['mgc_cb_evo'] = 1;
		
		// Construct chatbox display 
		require_once(DIR . '/mgc_cb_evo/classes/class_display.php'); 
		require_once(DIR . '/mgc_cb_evo/addons/cms/classes/class_display.php'); 
		$MGCCbEvoDisplay = new CMS_MGCCbEvo_display(vB::$vbulletin,$MGCCbEvoCore); 

		// Display construction 
		$output = $MGCCbEvoDisplay->construct_display();  
//echo "output_fichier : $output";	
	}
	else
	{
		$show['mgc_cb_evo'] = 0;	
	
	}
The commented line //echo "output_fichier : $output"; if uncommented, displays the chatbox at the top of the page in my SC

whereas in my template, this

Code:
output template {vb:raw output} $output
Only displays : output template $output
Reply With Quote
  #6  
Old 06-28-2015, 01:06 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The code you posted above, where so you have that? Is it in a plugin, in the forum block, or in forum.php?

You mentioned you template. What template is it, and where is the code that renders it? You said you added a call to $templater->register at the end of forum.php? Is hat where your template rendering code is, or are you adding it to the line for registering to FORUMHOME?
Reply With Quote
  #7  
Old 06-28-2015, 01:54 PM
Bastien's Avatar
Bastien Bastien is offline
 
Join Date: May 2015
Location: France
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This code is my forum.php

I m trying to do a "plugin" to add the chatbox in the side bar !

The content of my bloc is

Code:
$output='$output';
return $output;
and this bloc displays this template chatboxtoutcourt whichs contains :

Code:
<li>
    <div class="block smaller">
        <div class="blocksubhead">
            <a class="collapse" id="collapse_block_html_mgccbevo" href="{vb:raw relpath}#top"><img alt="" src="{vb:stylevar imgdir_button}/collapse_40b.png" id="collapseimg_html_mgccbevo"/></a>
            <span class="blocktitle">
            	Chatbox [<a href="{vb:raw vboptions.bburl}/{vb:raw vboptions.mgc_cb_evo_filename}.php?{vb:raw session.sessionurl}do=view_archives&amp;page=1">{vb:phrase mgc_cb_evo_archives}</a>]
            </span>
        </div>
        <div id="block_html_mgccbevo" class="blockbody floatcontainer">
            <div class="blockrow" align="center">
				<div style="width:100%; height: {vb:raw vboptions.mgc_cb_evo_notifs_sidebar_height}px;overflow-y: auto;border: none; z-index: 1;" id="schats_container">
					<table width="100%" align="{vb:stylevar left}" cellspacing="0" cellpadding="0">
						<tbody id="schats">
							<tr>
								<td>output template {vb:raw output} $output</td>
			  				</tr>
				  		</tbody>                  		
					</table>                  
				</div> 				
			</div>
        </div>
    </div>
    <div class="underblock"></div>
</li>
But this fu**in' var doesn't display in my template, whereas with the echo it does !
Reply With Quote
  #8  
Old 06-28-2015, 02:24 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, I think what you could do is to change the output part of the template to this:
Code:
<td>{vb:raw content}</td>
Then in the bloc code, do this:

PHP Code:
global $output;
return 
$output
(although it might be better to use a variable other than $output). Because the sidebar code will automatically take what is returned and register it to 'content' in the block template. You just need to make sure that $output is set before the sidebar is rendered.

You could also put all the code in the bloc content area, and return $output at the end, but maybe you're not doing that because you need $show['mgc_cb_evo'] set before it gets to the block code?
Reply With Quote
2 благодарности(ей) от:
Lynne, MarkFL
  #9  
Old 06-29-2015, 10:05 AM
Bastien's Avatar
Bastien Bastien is offline
 
Join Date: May 2015
Location: France
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you it works great !
Attached Images
File Type: png Capturer.PNG (49.9 KB, 0 views)
Reply With Quote
2 благодарности(ей) от:
kh99, MarkFL
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:08 AM.


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.05074 seconds
  • Memory Usage 2,275KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (8)bbcode_code
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (4)post_thanks_box_bit
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (2)postbit_attachment
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete