Any idea how can I remove this in $vars['closure']; ?
<!-- SiteCatalyst code version: H.19.4 Copyright 1997-2009 Omniture, Inc. More info available at http://www.omniture.com -->
<script type="text/javascript" language="JavaScript" src="/sites/all/themes/mytheme/js/s_code.js"></script>
<script type="text/javascript" language="JavaScript"><!--
/************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/
var s_code=s.t();if(s_code)document.write(s_code)//--></script>
<script language="JavaScript" type="text/javascript"><!--
if(navigator.appVersion.indexOf('MSIE')>=0)document.write(unescape('%3C')+'\!-'+'-')
//--></script><noscript><a href="http://www.omniture.com" title="Web Analytics"><img src="http://server.122.2O7.net/b/ss/frisky/1/H.19.4--NS/0/4256542"
height="1" width="1" border="0" alt="" /></a></noscript><!--/DO NOT REMOVE/-->
<!-- End SiteCatalyst code version: H.19.4 -->
I tried the methods explained by kiamlaluno in this thread but I cant remove the above code in the view source using preg_replace but no luck.
//Remove omniture tags in unpublish node
if(arg(0) == 'node' && $vars['node']->status == 0) {
$vars['closure'] = theme('closure');
$omnitureTags = preg_replace( "/\<!-- SiteCatalyst code version: H\.19\.4 Copyright 1997-2009.+\<!-- End SiteCatalyst code version: H\.19\.4 --\>/si", "", $vars['closure']);
$vars['closure'] = $omnitureTags;
} else {
$vars['closure'] = theme('closure');
}
The above code is now working according to what I need.
$vars['closure'] = theme('closure');
belongs there, if at all. But often in Drupal there is more than one way to do things. Of course, I assume you are aware that preprocess_page function only runs on unpublished pages. Good-luck, happy coding.theme('closure')
in here (which I assume is in a module) will certainly build the 'closure' variable, which is ok so far, but then when you preg_replace it, you print it instead of setting it... eg, you should do a$vars['closure']=preg_replace(.....)
If this doesn't work, then the module that is putting this in the closure variable is changing or adding it AFTER you've done your stuff, at which point you need to put this in your theme, which runs preprocess after all the modules are done.