PDA

View Full Version : [str_replace] Problem in vb4


omardealo
03-16-2013, 06:48 PM
Hello every one ,

i used that code but not worked

Hook : parse_templates

code :

$ain_nocopy = '<SCRIPT LANGUAGE="JavaScript"> CODE </SCRIPT>';

$ain_nocopy_css = '<style type="text/css">.ain_unselectable{CODE}</style>';

$search_text = '<!-- / CSS Stylesheet -->';

$vbulletin->templatecache['headinclude'] = str_replace($search_text, $ain_nocopy_css.$search_text.$ain_nocopy , $vbulletin->templatecache['headinclude']);





i know that "<!-- / CSS Stylesheet -->" not found in template headinclude , but i add it and still code not worked
Where the problem, thank you

Lynne
03-16-2013, 07:02 PM
exactly where in the headinclude template did you add the "<!-- / CSS Stylesheet -->" ?

omardealo
03-16-2013, 07:09 PM
I've solved a part of problem
But , What I want to do now is to put the code at the end of the template headinclude
Instead of searching for " <!-- / CSS Stylesheet --> "
Because it does not existthe in template headinclude

$ain_nocopy = '<SCRIPT LANGUAGE="JavaScript"> CODE </SCRIPT>';
$ain_nocopy_css = '<style type="text/css">.ain_unselectable{CODE}</style>';
$search_text = '<!-- / CSS Stylesheet -->';
$vbulletin->templatecache['headinclude'] = str_replace($search_text, $ain_nocopy_css.$search_text.$ain_nocopy , $vbulletin->templatecache['headinclude']);

kh99
03-16-2013, 10:34 PM
If you want to add something to the end of the headinclude template, you can use the headinclude_css template hook instead of doing a str_replace, like:

$ain_nocopy = '<SCRIPT LANGUAGE="JavaScript"> CODE </SCRIPT>';
$ain_nocopy_css = '<style type="text/css">.ain_unselectable{CODE}</style>';
$template_hook['headinclude_css'] .= $ain_nocopy_css.$ain_nocopy;

omardealo
03-17-2013, 12:53 PM
thnx , kh99 ... for ur code
i try something and worked good

$ain_nocopy = '<SCRIPT LANGUAGE="JavaScript"> CODE </SCRIPT>';
$ain_nocopy_css = '<style type="text/css">.ain_unselectable{CODE}</style>';
$search_text = '</SCRIPT>';
$vbulletin->templatecache['headinclude'] = str_replace($search_text, $ain_nocopy_css.$search_text.$ain_nocopy , $vbulletin->templatecache['headinclude']);

Thanks again, you can close the topic