Jump to content

Recommended Posts

Posted

Hey Guys, quick question. 

 

For module 'manage' tabs, we are running into 2 issues hopefully you can point us in the right direction. 

 

1) CSS, Since the tab switching is done via an ajax 'replacer' call, there is no way to 'inject' the css into the header of the page in the tab function. Where would be the 'right place' to load up the css for the module? (Doing it all inline really sucks).

 

2) AJAX.. is there a place or method of calling that we can use to properly call ajax, so that our functions can still access 'blesta' but so that blesta will just allow the code to run, and output the json back to the javascript without messing about with it. Kinda like the 'tab switching'.

 

James

Posted

Here's an example of each:

 

<script type="text/javascript">
$(document).ready(function() {
        // Load CSS (taken from SolusVM module)
	$(this).blestaSetHeadTag("link", {media:"screen", type:"text/css", rel:"stylesheet", href: "<?php echo $this->Html->safe($this->view_dir . "css/styles.css");?>"});

        // AJAX request (taken from admin_packages_add template
        $(document).blestaRequest('POST', '<?php echo $this->Html->safe($this->base_uri . "packages/moduleoptions/");?>', $('#module_id').closest('form').serialize() + meta_values,
		function(data) {
			if (data) {
				$('#module_options').html('');
				$('#module_email_tags').html('');
				$('#module_options').html(data.module_options);
				$('#module_email_tags').html(data.module_email_tags);
			}
		},
		null,
		{dataType:'json'}
	);
});
</script>

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...