vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Trying to convert a plugin (https://vborg.vbsupport.ru/showthread.php?t=240689)

Breakpoint 04-18-2010 01:24 AM

Trying to convert a plugin
 
I need to convert a plugin so the code works in VB4

Here is the code, can anyone please help me convert it. I am having some difficulties on how to change this to be biable in VB$

Code:

if ($_REQUEST['do'] == 'editthread' AND $threadinfo['open'] != 10) {
$vbulletin->templatecache['threadadmin_editthread'] = str_replace('$posticons','                <fieldset class=\"fieldset\">
                        <legend>$vbphrase[redirect_threads_to_url]</legend>
                        <div style=\"padding:$stylevar[formspacer]px\">
                                <div class=\"fieldset\">
                                        $vbphrase[redirect_threads_to_url_link]<br />
                                        <input type=\"text\" class=\"bginput\" name=\"isurlredirect\" value=\"$threadinfo[isurlredirect]\" size=\"50\" maxlength=\"250\" title=\"$vbphrase[optional]\" />
                                </div>

                        </div>
                </fieldset>
               
                $posticons',$vbulletin->templatecache['threadadmin_editthread']);
}

The main reason it is not working in VB4 is because it is trying to replace the $posticon which no longer exists in the template

Dylanblitz 04-18-2010 06:43 AM

Give this a try, not 100% sure but it should work

Code:

if ($_REQUEST['do'] == 'editthread' AND $threadinfo['open'] != 10)
{
$vbulletin->templatecache['threadadmin_editthread'] = str_replace('{vb:raw posticons}','                <fieldset class=\"fieldset\">
        <legend>{vb:rawphrase redirect_threads_to_url}</legend>
        <div style=\"padding:{vb:stylevar formspacer}px\">
                <div class=\"fieldset\">
                {vb:rawphrase redirect_threads_to_url_link}<br />
                <input type=\"text\" class=\"bginput\" name=\"isurlredirect\" value=\"{vb:raw threadinfo.isurlredirect}\" size=\"50\" maxlength=\"250\" title=\"{vb:rawphrase optional}\" />
                </div>

        </div>
</fieldset>
               
{vb:raw posticons}',$vbulletin->templatecache['threadadmin_editthread']);
}


Breakpoint 04-18-2010 02:43 PM

That didn't work, I am cuirous if its due to the string {vb:raw posticons} needing to be escaped due to maybe some conflicts with PHP or not

Lynne 04-18-2010 02:49 PM

In plugins, you don't use the new template syntax. You need to use, for instance, '.$vbphrase[redirect_threads_to_url].'

Breakpoint 04-18-2010 03:18 PM

I got that part, but how would I be able to refer to the {vb:raw posticons} portion in the code and also outbut something like {vb:raw posticons} since $posticons doesn't work

thanks

Lynne 04-18-2010 07:59 PM

I really don't understand what you mean. You want to modify the variable $posticons? On what page? When I do a search for $posticons in the files, I get several hits. So, which one of those pages are you looking to do something to? And did you pick an appropriate hook location?

Breakpoint 04-18-2010 10:42 PM

Hook: threadmanage_start
Template: threadadmin_editthread

What the code did was look for the instance of $posticon in that template an replace it with code which added an input field for added text.

Now I need to update his code to work in VB4 which seems to have {vb:raw posticons} in the template instead of $posticons

----

On a side note, lets say I wanted to make a plugin display Pst Icons, how would i make it since saying echo {vb:raw posticons}; or echo '{vb:raw posticons}'; doesn't work.

Lynne 04-19-2010 03:51 AM

In php, it is still called $posticons. {vb:raw posticons} is just template syntax.

Breakpoint 04-20-2010 01:24 AM

that doesnt work in the old code though when you run string replace function. Did switching to this "easy" template syntax ruin that? I bet so, not easy for programmers... who decided this should revert it back. Having two sepearate syntax's versus one is the opposite direction they were trying to go for...


All times are GMT. The time now is 03:48 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.01161 seconds
  • Memory Usage 1,728KB
  • 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
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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