vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   $theard_title in posts/bbcode (https://vborg.vbsupport.ru/showthread.php?t=226772)

Ghostt 10-25-2009 07:02 PM

$theard_title in posts/bbcode
 
how do I get the Topic -title shown in the post (and in the bbcode)? "$title" or "$theard_title" does not work.


in phpbb3 it was solved with a simple code snippet:


open viewtopic.php
find
Code:

'MESSAGE'            => $message,
replace with
Code:

'MESSAGE'        => str_replace('{title}', $topic_data['topic_title'], $message),
For every time someone writes {title} is replaced by the title of the topic.

Lynne 10-26-2009 03:09 AM

Show it in what bbcode? You could write a plugin to do a str_replace, I suppose. I'm really not sure what to suggest since I don't have a clear picture of what you are wanting to do.

Ghostt 10-26-2009 04:17 PM

Ok i have to tell you what i want to do with it:
For example if i want to search for the topic title in youtube:
http://www.youtube.com/results?searc...&search_query=$theard_title+trailer&gl=DE

the link would be in a bbcode ...

the "$theard_title" for example would be the parse for the Topic title ..... but isnt working

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

do you understand what i mean now?

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

no ideas?

Ghostt 10-30-2009 08:30 AM

help here pls!

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

no coders here?

RenatoMN 10-31-2009 10:36 PM

Try it:

AdminCP > Plugins > Add a Plugin

Product: vBulletin
Hook: postbit_display_complete
Title: Replace thread title
Execution order: 5
PHP Code:

$post[message] = str_ireplace("{title}","$foruminfo[title]",$post[message]); 

Plugin is active: Yes //do not forget this :)

(you may see a line break here, but it's all a single line)

note: str_ireplace (case insensitive) is a bit more intensive than str_replace.
Use str_replace if you prefer (your users will forced to use it in lowecase).

Ghostt 11-01-2009 01:08 PM

i called it with {title} right?
but it shows nothing. ... not working for me :/ do youve tested it=?
Quote:

Originally Posted by RenatoMN (Post 1908815)
Try it:

AdminCP > Plugins > Add a Plugin

Product: vBulletin
Hook: postbit_display_complete
Title: Replace thread title
Execution order: 5
PHP Code:

$post[message] = str_ireplace("{title}","$foruminfo[title]",$post[message]); 

Plugin is active: Yes //do not forget this :)

(you may see a line break here, but it's all a single line)

note: str_ireplace (case insensitive) is a bit more intensive than str_replace.
Use str_replace if you prefer (your users will forced to use it in lowecase).

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

no help?

RenatoMN 11-03-2009 02:43 AM

Sorry! I tested but I typed it directly here (without copy/pasting) and there's a typo:

It's "$thread[title]"

Final code:

PHP Code:

$post[message] = str_ireplace("{title}","$thread[title]",$post[message]); 

--

Suggestion for Youtube trailer search:

PHP Code:

$post[message] = str_ireplace("{threadtrailer}","<a target=\"_blank\" href=\"http://www.youtube.com/results?search_query=".mb_convert_encoding(str_replace(" ","+","$thread[title]"),"UTF-8")."+Trailer&search_type=&aq=f&oq=\">".$vbphrase[search]." ".$thread[title]." Trailer @ YouTube</a>",$post[message]); 


In a thread titled "Batman Begins" will convert {threadtrailer} to: Search Batman Begins Trailer @ YouTube

Or a simplified:

PHP Code:

$post[message] = str_ireplace("{threadtrailer}","<a target=\"_blank\" href=\"http://www.youtube.com/results?search_query=".mb_convert_encoding(str_replace(" ","+","$thread[title]"),"UTF-8")."+Trailer&search_type=&aq=f&oq=\">".$vbphrase[search]." Trailer @ YouTube</a>",$post[message]); 

In a thread titled "Batman Begins" will convert {threadtrailer} to: Search Trailer @ YouTube
(no thread name in the visible link, only in URL)

Note: if you edit the code, do not remove mb_converting_encoding. It is necessary because YouTube use UTF-8, so if your forums use ISO-8559-1, you will ever see "no results" when you click the link in a thread with ANY accentuated character.


All times are GMT. The time now is 04:47 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.01161 seconds
  • Memory Usage 1,745KB
  • 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
  • (5)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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