vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Search and str_replace (https://vborg.vbsupport.ru/showthread.php?t=229360)

Seven Skins 12-02-2009 06:25 PM

Search and str_replace
 
I was just wondring can {vb:raw navbits.breadcrumb} be search and replace by using the code below?

PHP Code:

$find "{vb:raw navbits.breadcrumb}";
$replace "Joe Blogs";
$myvar str_replace($find,$replace,$myvar); 

I have been trying to do this but no luck. I can search and replace normal HTML or Text.

Thanks

.

BBR-APBT 12-02-2009 06:37 PM

Is this in a plugin?

Try this code I got from one of Lynne's mods.
Code:

$find = '{vb:raw navbits.breadcrumb}';
$replace = "Joe Blogs". PHP_EOL;
$output = str_replace($find,$replace.$find, $output);


Lynne 12-02-2009 06:38 PM

No. You need to do search and replace on something that is 'real', not some variable that needs to be parsed.

edit: ". PHP_EOL" just gives a line break in the source code - php End Of Line.

Seven Skins 12-02-2009 06:45 PM

OK ... Is there any way I can add "{vb:raw my_text}" to the very top of footer template ... as the 1st line in footer template is "{vb:raw ad_location.ad_footer_start}".

.

BBR-APBT 12-02-2009 06:51 PM

Put it in the ad_footer_start template.

Seven Skins 12-02-2009 06:52 PM

Quote:

Originally Posted by BBR-APBT (Post 1924224)
Is this in a plugin?

Try this code I got from one of Lynne's mods.
Code:

$find = '{vb:raw navbits.breadcrumb}';
$replace = "Joe Blogs". PHP_EOL;
$output = str_replace($find,$replace.$find, $output);


I have tried this but does not work .... as Lynne said we need some thing real.
Yes it is a plugin.
I need to add "{vb:raw my_text}" on top of my footer template via plugin.

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

Quote:

Originally Posted by BBR-APBT (Post 1924235)
Put it in the ad_footer_start template.

"{vb:raw my_text}" has another template in it so this is not going to work.

BBR-APBT 12-02-2009 07:00 PM

Ok re-ordered to place it just below
Code:

{vb:raw ad_location.ad_footer_start}
{vb:raw ad_location.global_above_footer}

and above
Code:

<div class="footercontainer">
This should do the trick.
Code:

$find = '<div class="footercontainer">';
$replace = "{vb:raw my_text}". PHP_EOL;
$output = str_replace($find,$replace.$find, $output);


Seven Skins 12-02-2009 07:17 PM

I am making a product to release here and I want the users to just install and use ... no template modifications if possible.

If the template modification is needed I will just ask them to add "{vb:raw my_text}" on top of the footer template. It saves me writing plugins loads of plugins.

Thanks for your help.

.

BBR-APBT 12-02-2009 07:22 PM

Quote:

Originally Posted by Seven Skins (Post 1924250)
I am making a product to release here and I want the users to just install and use ... no template modifications if possible.

If the template modification is needed I will just ask them to add "{vb:raw my_text}" on top of the footer template. It saves me writing plugins loads of plugins.

Thanks for your help.

.

So did this work?
Code:

$find = '<div class="footercontainer">';
$replace = "{vb:raw my_text}". PHP_EOL;
$output = str_replace($find,$replace.$find, $output);

people help me I help others.

Seven Skins 12-02-2009 07:26 PM

Yes it works I did try this before but thats the 3rd line in footer template. When you put ads in ad_location templates .. it screws the layout specially if the ads are wide.

.


All times are GMT. The time now is 06:43 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.01208 seconds
  • Memory Usage 1,738KB
  • 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
  • (6)bbcode_code_printable
  • (1)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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