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 02-12-2011, 08:44 PM
Nuss Nuss is offline
 
Join Date: Apr 2004
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Plugin show Unparsed HTML

Hi guys i've a problem showing HTML in one of my plugins..

Need to show: <a href="link">Link!</a>, this HTML appear on my forum, but Unparsed...

The plugin is in global_start i need to change this??

Thanks a lot!
Reply With Quote
  #2  
Old 02-12-2011, 10:10 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need to post your actual plugin code for us to see what you are doing.

Also, please note the the hook at global_start is deprecated.
Reply With Quote
  #3  
Old 02-12-2011, 10:42 PM
Nuss Nuss is offline
 
Join Date: Apr 2004
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, Lynne, here is my plugin Code.


Quote:

** SQL CONECTION **

$aniTMP = "";

while($row_sl = mysql_fetch_array($result_sl)){

$aniTMP .= '<a href="http://www.xxxxx.com.ar/descargadirecta/ver.php?cod='.$row_sl['xxx'].'" target="_blank">';
$aniTMP .= '<img src="'.$row_sl['xxx'].'" border="0"></a>';
$aniTMP .= '<a href="http://www.xxxxx.com.ar/descargadirecta/ver.php?cod='.$row_sl['xxx'].'" target="_blank">';
$aniTMP .= $row_sl['xxx'].'</a>';
$aniTMP .= $row_sl['xxx'];


}


$myarray=array();
$myarray['anidbItems']= $aniTMP;
vB_Template:reRegister('ct_animedb_slider', $myarray);

ct_animedb_slider is a Custom template, here the code:

Quote:
{vb:var anidbItems}

This template also is included in Vbulletin's header template:

Quote:
{vb:raw ct_header}
{vb:raw ct_animedb_slider}

<div class="above_body"> <!-- closing tag is in template navbar -->
<div id="header" class="floatcontainer doc_header">
<div><a name="top" href="{vb:link forumhome}" class="logo-image"><img src="{vb:stylevar titleimage}" alt="{vb:rawphrase x_powered_by_vbulletin, {vb:raw vboptions.bbtitle}}" /></a></div>
<div id="toplinks" class="toplinks">
<vb:if condition="$show['member']">
<ul class="isuser">
<li><a href="login.php?{vb:raw session.sessionurl}do=logout&amp;logouthash={vb:ra w bbuserinfo.logouthash}" onclick="return log_out('{vb:rawphrase sure_you_want_to_log_out}')">{vb:rawphrase log_out}</a></li>
<vb:if condition="$show['registerbutton']">
<li><a href="register.php{vb:raw session.sessionurl_q}" rel="nofollow">{vb:rawphrase register}</a></li>
</vb:if>
<li><a href="usercp.php{vb:raw session.sessionurl_q}">{vb:rawphrase control_panel}</a></li>
<li><a href="{vb:link member, {vb:raw bbuserinfo}}">{vb:rawphrase your_profile}</a></li>
<vb:if condition="$notifications_total">
<li class="popupmenu notifications" id="notifications">
<a class="popupctrl" href="usercp.php{vb:raw session.sessionurl_q}">{vb:rawphrase your_notifications}: <span class="notifications-number"><strong>{vb:raw notifications_total}</strong></span></a>
<ul class="popupbody popuphover">
{vb:raw notifications_menubits}
</ul>
</li>
<vb:else />
<li class="popupmenu nonotifications" id="nonotifications">
<a class="popupctrl" href="usercp.php{vb:raw session.sessionurl_q}">{vb:rawphrase your_notifications}</a>
<ul class="popupbody popuphover">
<li>{vb:rawphrase no_new_messages}</li>
<li><a href="private.php{vb:raw session.sessionurl_q}">{vb:rawphrase inbox}</a></li>
</ul>
</li>
</vb:if>
<li class="welcomelink">{vb:rawphrase welcome_x_link_y, {vb:raw bbuserinfo.username}, {vb:link member, {vb:raw bbuserinfo}}}</li>
<vb:if condition="$vboptions['enablefacebookconnect']">
{vb:raw facebook_header}
</vb:if>
</ul>
{vb:raw template_hook.header_userinfo}
<vb:comment><p>{vb:rawphrase last_visited_x_at_y, {vb:raw pmbox.lastvisitdate}, {vb:raw pmbox.lastvisittime}}</p></vb:comment>
<vb:else />
<ul class="nouser">
<vb:if condition="$show['registerbutton']">
<li><a href="register.php{vb:raw session.sessionurl_q}" rel="nofollow">{vb:rawphrase register}</a></li>
</vb:if>
<li><a rel="help" href="faq.php{vb:raw session.sessionurl_q}">{vb:rawphrase help}</a></li>
<li>
<script type="text/javascript" src="clientscript/vbulletin_md5.js?v={vb:raw vboptions.simpleversion}"></script>
<form id="navbar_loginform" action="login.php?{vb:raw session.sessionurl}do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, {vb:raw show.nopasswordempty})">
<fieldset id="logindetails" class="logindetails">
<div>
<div>
<input type="text" class="textbox<vb:if condition="!$username"> default-value</vb:if>" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="101" value="<vb:if condition="$username">{vb:raw username}<vb:else />{vb:rawphrase username}</vb:if>" />
<input type="password" class="textbox" tabindex="102" name="vb_login_password" id="navbar_password" size="10" />
<input type="text" class="textbox default-value" tabindex="102" name="vb_login_password_hint" id="navbar_password_hint" size="10" value="{vb:rawphrase password}" style="display:none;" />
<input type="submit" class="loginbutton" tabindex="104" value="{vb:rawphrase log_in}" title="{vb:rawphrase enter_username_to_login_or_register}" accesskey="s" />
</div>
</div>
</fieldset>
<div id="remember" class="remember">
<label for="cb_cookieuser_navbar"><input type="checkbox" name="cookieuser" value="1" id="cb_cookieuser_navbar" class="cb_cookieuser_navbar" accesskey="c" tabindex="103" /> {vb:rawphrase remember_me}</label>
</div>

<input type="hidden" name="s" value="{vb:raw session.sessionhash}" />
<input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
<input type="hidden" name="do" value="login" />
<input type="hidden" name="vb_login_md5password" />
<input type="hidden" name="vb_login_md5password_utf" />
</form>
<script type="text/javascript">
YAHOO.util.Dom.setStyle('navbar_password_hint', "display", "inline");
YAHOO.util.Dom.setStyle('navbar_password', "display", "none");
vB_XHTML_Ready.subscribe(function()
{
//
YAHOO.util.Event.on('navbar_username', "focus", navbar_username_focus);
YAHOO.util.Event.on('navbar_username', "blur", navbar_username_blur);
YAHOO.util.Event.on('navbar_password_hint', "focus", navbar_password_hint);
YAHOO.util.Event.on('navbar_password', "blur", navbar_password);
});

function navbar_username_focus(e)
{
//
var textbox = YAHOO.util.Event.getTarget(e);
if (textbox.value == '<vb:if condition="$username">{vb:raw username}<vb:else />{vb:rawphrase username}</vb:if>')
{
//
textbox.value='';
textbox.style.color='{vb:stylevar toplinks_form_input.color}';
}
}

function navbar_username_blur(e)
{
//
var textbox = YAHOO.util.Event.getTarget(e);
if (textbox.value == '')
{
//
textbox.value='<vb:if condition="$username">{vb:raw username}<vb:else />{vb:rawphrase username}</vb:if>';
textbox.style.color='{vb:stylevar toplinks_form_input_defaultValue.color}';
}
}

function navbar_password_hint(e)
{
//
var textbox = YAHOO.util.Event.getTarget(e);

YAHOO.util.Dom.setStyle('navbar_password_hint', "display", "none");
YAHOO.util.Dom.setStyle('navbar_password', "display", "inline");
YAHOO.util.Dom.get('navbar_password').focus();
}

function navbar_password(e)
{
//
var textbox = YAHOO.util.Event.getTarget(e);

if (textbox.value == '')
{
YAHOO.util.Dom.setStyle('navbar_password_hint', "display", "inline");
YAHOO.util.Dom.setStyle('navbar_password', "display", "none");
}
}
</script>
</li>
<vb:if condition="$vboptions['enablefacebookconnect']">
{vb:raw facebook_header}
</vb:if>
</ul>
</vb:if>
</div>
<div class="ad_global_header">
{vb:raw ad_location.global_header1}
{vb:raw ad_location.global_header2}
</div>
<hr />
</div>
Reply With Quote
  #4  
Old 02-13-2011, 03:37 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I see code where you preregistered a variable for use in a template (not needed if you are the one to create the template), but I never see the code to create the template - that has to be somewhere also. You've also never defined the variable "ct_animedb_slider" I know you have a template with that name, but you are using it as a variable in the header template and it's never defined.
Reply With Quote
  #5  
Old 02-13-2011, 01:22 PM
Nuss Nuss is offline
 
Join Date: Apr 2004
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry , forgot post it, this is the plugin that create the template.

Name: Slider AnimeDB
Quote:
$templater = vB_Template::create('ct_animedb_slider');
$templatevalues['ct_animedb_slider'] = $templater->render();

vB_Template:reRegister('header', $templatevalues);



I'm reading this article: https://vborg.vbsupport.ru/showthread.php?t=228078 and i figured how to register a var, like this: $templater->register('my_var', $my_var);

But i really dont understood where i need to register them and if this can solve my problem.


So i have 2 templates and 2 plugins.

1 Plugin) Called "Slider AnimeDB" Make and Register the template "
Quote:
ct_animedb_slider
"

Plugin Code:
Quote:
$templater = vB_Template::create('ct_animedb_slider');
$templatevalues['ct_animedb_slider'] = $templater->render();

vB_Template:reRegister('header', $templatevalues);
2 Plugin) Called "Anidb Items" got information from DB and put it into a variable "anidbItems"

Plugin code:
Quote:


$aniTMP = "";

while($row_sl = mysql_fetch_array($result_sl)){

$aniTMP .= '<a href="http://www.xxxx.com.ar/descargadirecta/ver.php?cod='.$row_sl['xxx'].'" target="_blank">';
$aniTMP .= '<img src="'.$row_sl['xxx'].'" border="0"></a>';
$aniTMP .= '<a href="http://www.xxxx.com.ar/descargadirecta/ver.php?cod='.$row_sl['xxx'].'" target="_blank">';
$aniTMP .= $row_sl['xxx'].'</a>';
$aniTMP .= $row_sl['xxx'];


}


$myarray=array();
$myarray['anidbItems']= $aniTMP;

vB_Template:reRegister('ct_animedb_slider', $myarray);
1 template) Called "ct_animedb_slider" this template is included in Vbulletin's header template and display "anidbItems" var, by the moment the code just:

Quote:
{vb:var anidbItems}
2 template) Vbulletin header tempalte, i posted in the first post.. so here i include de ct_animedb_slider template for show it.




Ok, i dont understand where i need to register the Var "ct_animedb_slider" and i dont know if is correct that i'm doing, srry this new plugin system is really confuse for me.

Thanks for your time!
Reply With Quote
  #6  
Old 02-13-2011, 02:35 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Instead of:
PHP Code:
$myarray=array();
$myarray['anidbItems']= $aniTMP;

vB_Template::preRegister('ct_animedb_slider'$myarray); 
You should have what you listed for another plugin:
PHP Code:
$templater vB_Template::create('ct_animedb_slider'); 
    
$template->register('myarray'$myarray);
$templatevalues['ct_animedb_slider'] = $templater->render(); 
 
vB_Template::preRegister('header'$templatevalues); 
You have this line:
$myarray['anidbItems']= $aniTMP;

Therefore, myarray is the variable to use, not anidbItems in the template.
Reply With Quote
  #7  
Old 02-13-2011, 03:14 PM
Nuss Nuss is offline
 
Join Date: Apr 2004
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Lynne i solved by this way (if someone have the some problem)

In ct_anime_slider template, i wrote: {vb:raw anidbItems}
({vb:raw myarray.anidbItems} does't worked)

And in Slider AnimeDb plugin, i wrote:

Quote:
$templater = vB_Template::create('ct_animedb_slider');
$templater->register('myarray', $myarray);
$templatevalues['ct_animedb_slider'] = $templater->render();

vB_Template:reRegister('header', $templatevalues);
(Added $templater->register('myarray', $myarray); )


Anidb Items Still untouched.

Thanks a Lot, this is working now
Reply With Quote
  #8  
Old 02-13-2011, 03:37 PM
SiteTalkZone SiteTalkZone is offline
 
Join Date: Dec 2008
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@Nuss:
Because the formal syntax of preRegister is:
Code:
$myarray['anidbItems'] = 'somevalue';
$notarray = 'anothervalue';
vB_Template : preRegister('header', array('myarray' => $myarray, 'notarray' => $notarray);
So if you use above syntax, in template you can call var myarray by using code:
Code:
{vb : raw myarray.anidbItems}
{vb : raw notarray}
Reply With Quote
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:06 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.04581 seconds
  • Memory Usage 2,267KB
  • Queries Executed 13 (?)
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
  • (2)bbcode_code
  • (2)bbcode_php
  • (9)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete