Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By tebdilikiyafet on
Hi,
I added a code to my template.php which is add jquery ui.dialog.js file to the page. And this code works only for specific content type. Also boost module work on my site.
But after added this code site performance decreased. Load average values are so high. You can see my code below. What can be the reason of performance decreasing?
Added to template.php
function garland_preprocess_page(&$variables) {
if (isset($variables['node']) && $variables['node']->type == 'product') {//'product' is the target content type
// Add js
drupal_add_css(drupal_get_path('modules', 'jquery_ui') . '/themes/default/ui.all.css');
jquery_ui_add('ui.dialog');
$variables['scripts'] = drupal_get_js();
}
}
Added to node-product.tpl.php
echo '<div id="popupdialog" title="Warning">Bla bla bla bla</div>
<script language="javascript">
if (Drupal.jsEnabled) {
jQuery(document).ready(function(){
jQuery("#popupdialog").dialog({
closeOnEscape: false,
modal:true,
buttons: {
"Yes": function() {
$( this ).dialog( "close" );
},
"No": function() {
window.location = "http://www.example.com";
}
}
});
});
}
</script>
';