07 Nov

Save HTML Table to Excel using jQuery

After a few hours work looking into this, this turned out really easy to implement using jQuery and server side PHP programming as follows:

On the client side the following HTML code needs adding to the page (note this is older code – for newer code follow link at bottom):

Note – variables used above – ReportTable is the id of the table you want to save and datatodisplay is a hidden variable used to post the table to the server.

The jQuery commands were added to the form’s onsubmit event but could easily be in your $(function(){}); fuction

The hard part here was getting all of the <table> HTML code.… Read the rest

15 Jul

Make WordPress Mobile Friendly

Following on my theme for this week, here are the steps to make WordPress mobile friendly. This assumes you are using a separate URL for your mobile friendly wordpress (such as sitename.mobi):

1 – Buy your domain and park it on your current WordPress site, so sitename.com and sitename.mobi are generating the same content

2 – Add (or modify) the file /wp-content/themes/yourtheme/functions.php and add the following lines:

<?php
remove_action(‘template_redirect’, ‘redirect_canonical’);

function elixir_urlrewrite( $url ) {… Read the rest

08 Jul

Making Your Site Mobile Friendly – CSS

CSS is vitally important in making your site mobile ready. I ended up making 3 CSS media sections in one CSS file:

  • @media screen – contains all the CSS positioning informaiton, font sizes needed for the screen, etc.
  • @media handheld – the CSS for handhelds. This removed a lot of unneeded parts of the screen (footer text), and doesn’t include positioning information.
  • @media print – CSS for when the page is printed. This changes the font size for printing, labels links for printing, turns off unnecessary navigation (left hand menus, footer, etc) and anything else to make your site look good when printed.
Read the rest