Import Script, Import CSS, Import PHP

Just because sometimes I forget, here are some code fragments to import JavaScript, CSS, and PHP files.

JavaScript:

<script
   type='text/javascript'
   src='directory/file.js'>
</script>

CSS:

<style type='text/css'  media='all'>
   @import 'directory/file.css';
</style>

Icon:

<link
   rel='Shortcut Icon'
   href='directory/file.ico'
   type='image/x-icon'>

PHP:

<?php @ require_once ('directory/file.html'); ?>

For the PHP import, by placing the @ symbol before require_once suppresses any error messages that might be generated in the included PHP file.

JSP:

<%@ include file='jspfile.jspi' %>

And, well, I guess the list can go on and on. You can use Struts Tiles to include other JSP snippets. I am sure that other languages and frameworks have the same functionality.

Related posts:

  1. JSP Include Me
  2. Run PHP Web Applications on the Java Platform
  3. CSS Hackary
  4. Rounded Corners with CSS border-radius Property
  5. MySQL Import Export
  6. Add Shadows with CSS box-shadow Property


Leave a Reply