vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Messing with $post[message] in functions_newpost.php-The quest continues! Form vars? (https://vborg.vbsupport.ru/showthread.php?t=206774)

MTGDarkness 02-27-2009 08:48 AM

Messing with $post[message] in functions_newpost.php-The quest continues! Form vars?
 
I want to add a snippet of code to each $post[message]. It's for a modification I'm working on. How can I add, say, a conditional clause to it? I tried editing the postbit template and it didn't work...

Dismounted 02-27-2009 08:58 AM

As you mentioned, editing the postbit(_legacy) template should be sufficient. What exactly did you do?

MTGDarkness 02-27-2009 08:58 AM

What I'm trying to do is, again, set up this automatic BBCode thing that I've been looking for.

I tried setting it up like this:

Code:

<if condition="$post[field11] AND $post[field12]">$post[field11]</if>
                        $post[message]
<if condition="$post[field11] AND $post[field12]">$post[field12]</if>

Where field 11 and 12 are single line text fields asking for BBCode beginning and end tags, respectively, but this basically just adds the content to the beginning and end of each post, and if it's BBCode (which it's supposed to be), it doesn't parse. I also have the feeling that this is a security risk.

Dismounted 02-27-2009 09:01 AM

You need to convert the BB Code into HTML (called "parsing"). This needs to be done inside a plugin. (There are articles describing how to parse BB code.)

MTGDarkness 02-27-2009 09:09 AM

https://vborg.vbsupport.ru/showthrea...ghlight=bbcode

I'm not quite sure what I'm doing here. I started out on this code:

Code:

<if condition="$post[field11] AND $post[field12]">
$text = $post[field11] $post[field12]
$do_html = false
$do_smilies = true
$do_bbcode = true
$do_imgcode = true
$do_nl2br = true
$cachable = false
</if>

$parsed_text
                        $post[message]
<if condition="$post[field11] AND $post[field12]">$post[field12]</if>

It's not finished yet, because I realized that I'm going to have a hell of a time trying to get the parser to parse half of the bbcode, then the other half. And I'm not sure how to make it parse both.

--------------- Added [DATE]1235735146[/DATE] at [TIME]1235735146[/TIME] ---------------

Is there any way to just modify what goes in to $post[message]?

Lynne 02-27-2009 03:03 PM

You cannot do php in a template. You will have to write a plugin to do that.

MTGDarkness 02-27-2009 03:23 PM

Can't I just fiddle with the $post[message] instead? Wouldn't that be simpler?

Lynne 02-27-2009 03:39 PM

If you are going to 'fiddle' with $post[message] before it is spit out in the template, you must do so using a plugin.

MTGDarkness 02-27-2009 03:44 PM

Oooh... I see. And which plugin hook? I'm guessing Postdata_Start, but I really don't know where all these hooks go to.

Lynne 02-27-2009 05:37 PM

If you are in debug mode, there is a list of all the plugins called for the page on the bottom. I think I usually use postbit_display_start when I want to change something that is going into the postbit. But, you can certainly try different locations.


All times are GMT. The time now is 09:03 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.01911 seconds
  • Memory Usage 1,727KB
  • 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)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete