vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Code Question (https://vborg.vbsupport.ru/showthread.php?t=204531)

wraggster 02-07-2009 09:29 AM

Code Question
 
Hi all i have some code i want to insert into my forum ie this

Code:

function convert_aff_links( $_body, $_aff_id = '2pz' )
{
        $_body = preg_replace
        (
                '@://(w+\.)?(playasia|play-asia)\.com/?([^/a-zA-Z])@',
                '://www.play-asia.com/SOap-23-' . '83-' . $_aff_id . '-50-00.html$3',
                $_body
        );

        $_body = preg_replace
        (
                '/paOS-(\d{2})/',
                'SOap-23-' . '83-' . $_aff_id . '-50-$1',
                $_body
        );

        return $_body;
}

but when i edit the header/footer templates it shows up on my forum rather than just hidden in the background, is there a bit of code i need to add to make it hide ?

Lynne 02-07-2009 04:12 PM

You cannot put php code in a template. Templates are for html. If you need to add php code, you need to either edit the file or add it in a plugin.

wraggster 02-08-2009 03:44 PM

thanks for the reply, where would be a good place to insert the code to test it ?

Lynne 02-08-2009 03:51 PM

You want this run on every page? I suppose you could try one of the global_xx locations.

wraggster 02-08-2009 03:58 PM

thanks again, yes every page would be great, ill give the global locations a try :)

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

hmm not working, im begining to wonder if the code is actually valid

thanks for the replys, ill have to admit defeat i reckon :)

Dismounted 02-10-2009 05:59 AM

You are probably looking to modify the $output variable in global_complete.


All times are GMT. The time now is 09:59 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.01052 seconds
  • Memory Usage 1,716KB
  • 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
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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