Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-25-2009, 07:02 PM
Ghostt Ghostt is offline
 
Join Date: Oct 2009
Posts: 359
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default $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.
Reply With Quote
  #2  
Old 10-26-2009, 03:09 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 10-26-2009, 04:17 PM
Ghostt Ghostt is offline
 
Join Date: Oct 2009
Posts: 359
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #4  
Old 10-30-2009, 08:30 AM
Ghostt Ghostt is offline
 
Join Date: Oct 2009
Posts: 359
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

help here pls!

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

no coders here?
Reply With Quote
  #5  
Old 10-31-2009, 10:36 PM
RenatoMN's Avatar
RenatoMN RenatoMN is offline
 
Join Date: Nov 2008
Location: Brazil
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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).
Reply With Quote
  #6  
Old 11-01-2009, 01:08 PM
Ghostt Ghostt is offline
 
Join Date: Oct 2009
Posts: 359
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i called it with {title} right?
but it shows nothing. ... not working for me :/ do youve tested it=?
Quote:
Originally Posted by RenatoMN View Post
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?
Reply With Quote
  #7  
Old 11-03-2009, 02:43 AM
RenatoMN's Avatar
RenatoMN RenatoMN is offline
 
Join Date: Nov 2008
Location: Brazil
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
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 09:22 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.03732 seconds
  • Memory Usage 2,234KB
  • Queries Executed 11 (?)
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
  • (5)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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_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