ASP.NET AJAX calendarExtendar – How to fix problems with days (saturday) being cut / chopped off

April 8th, 2009

If you can’t see the Saturday column on your calendar its because of the padding applied throughout your document. You may already of realised this was the problem and not managed to track down the padding.

The best and easiest solution is to use a custom css class to over-ride the default like below and use the following to clear the padding and margins:

.cal_Theme1 * {padding:0px;margin:0px;}

 The styles below can go in a linked stylesheet of in your document head.

/* Calendar css */
.cal_Theme1 * {padding:0px;margin:0px;}
.cal_Theme1 .ajax__calendar_container {background-color: #e2e2e2;width:192px;border:solid 1px #cccccc;}
.cal_Theme1 .ajax__calendar_header{background-color: #ffffff; margin-bottom: 4px;}
.cal_Theme1 .ajax__calendar_title,
.cal_Theme1 .ajax__calendar_next,
.cal_Theme1 .ajax__calendar_prev{color: #004080; padding-top: 3px;}
.cal_Theme1 .ajax__calendar_body{background-color: #e9e9e9; border: solid 1px #cccccc;}
.cal_Theme1 .ajax__calendar_dayname{text-align:center; font-weight:bold; margin-bottom: 4px; margin-top: 2px;}
.cal_Theme1 .ajax__calendar_day{text-align:center;}
.cal_Theme1 .ajax__calendar_hover .ajax__calendar_day,
.cal_Theme1 .ajax__calendar_hover .ajax__calendar_month,
.cal_Theme1 .ajax__calendar_hover .ajax__calendar_year,
.cal_Theme1 .ajax__calendar_active{color: #004080; font-weight:bold; background-color: #ffffff;}
.cal_Theme1 .ajax__calendar_today{font-weight:bold;}
.cal_Theme1 .ajax__calendar_other,
.cal_Theme1 .ajax__calendar_hover .ajax__calendar_today,
.cal_Theme1 .ajax__calendar_hover .ajax__calendar_title{color: #bbbbbb;}

ASP Code:

this is how you reference the style you created above in the asp page

<asp:TextBox ID=”F1_I2″ runat=”server” CssClass=”bigInput”>
</asp:TextBox>
<cc1:CalendarExtender ID=”F1_I2_CalendarExtender” CssClass=”cal_Theme1″ runat=”server” TargetControlID=”F1_I2″ Format=”dd/MM/yyyy”>
</cc1:CalendarExtender>

Win 2 x Tickets – Fac51 The Hacienda 27th Birthday @ Sankeys, Manchester

March 30th, 2009

Hacienda Logo 
Win 2x Tickets for Hacienda’s 27th Birthday @ Sankeys! Special Guests : Darren Emerson (Underwater), Justin Robertson (Most Excellent), Jon Dasilva (The Haçienda), “Temperance Club” Upstairs – The Whip (DJ Set), Peter Hook (New Order), Dave Haslam (The Haçienda). Bar hosted by Umbrella. Sunday May 3rd – 9pm to 5am
Free Competition available on my other site here:

http://www.socialaddict.co.uk/competition/enter?id=4

 

ASP.NET MVC 1.0 Released! RTW (release to web)

March 19th, 2009

I am pleased to notify that  ASP.NET MVC 1.0 has now been released as announced yesterday by Scott Gu at the MIX#09 conference.

Download from here: http://go.microsoft.com/fwlink/?LinkId=144444

 

HTTP Status codes and how to trigger them in PHP

March 10th, 2009

I will be adding all the codes to this post but for now here is how to do a php 301 redirect

PHP 301 Redirect

If you have upgraded your website and renamed some of your files, make sure you don’t get any 404 error’s – Google will punish you for it!

simply put the following lines of code at the old location:

header(“HTTP/1.1 301 Moved Permanently”);
header(“Location: http://www.yourdomain.com/newpage.php”);
exit();

SocialAddict – website now back online

February 26th, 2009

Just to let you know we have finally got SocialAddict back online and we are starting to get things going again. The events page is now live and we are improving it all the time. The galleries will all be online shortly so please support us by signing up and getting involved with the chat on there!!

 

http://www.socialaddict.co.uk

Win a luxury house in Cheltenham!

January 20th, 2009

Ashton Market Now Open

November 28th, 2008

Ashton Under Lyne Indoor Market is now open to the public.

 

The old market was burn down in May 2004 and a temporary indoor market was setup in a nearby car park. It took a long time to investigate the cause of the fire (which I believe is still unknown) and this is what caused a delay in the re-build process. The original walls are still in place but a complete new roof and layout has been introduced inside and it is looking very nice indeed.

 

Google Analytics New Version Released – 7th November 2008

November 7th, 2008

OK so google have released an updated version of Analytics, different layout and few new features!

You can now see from your summary page a summary of key data. Including a thumbs up or down image to indicate whether or not you have gone up or down in traffic. Pretty handy!!

Login to your control panel and let me know your views!!

Google Car Spotted on M60 Motorway recording 360 footage

November 5th, 2008

I saw the google maps vehicle driving along the motorway with a 5ft pillar on the roof with what looked like a 360 camera on the top! I can only assume that they are recording the ground level mapping of the uk in video format which is pretty crazy :)

Does anyone know more about this or have you seen it?!

Comments appreciated!!

How To Convert your website to use multiple languages for foreign visitors

November 4th, 2008

So you have an old website or even a current one and you not have the need for several languages because of the traffic your getting. There are many ways of doing this and im giving a fairly simplistic method (simple is not a bad thing in this case). I will be doing this tutorial in a few programming languages but i will first show you in PHP as its my favourite :)

PHP METHOD

I will break this down into a few stages for you. Im going to assume that you have some header text you need to be multi lingual and the navigation links (but this is really irrelevant as you can use this method wherever you need). This is designed for the static content on your pages (i will cover a similar method for DB driven content as soon as someone requests it or i get chance!)

Breakdown of Tasks

  1. create languages folder in your web root (or wherever you want on your web server)
  2. create english.php file within that for starters
  3. create definitions within that file, one for each static piece of text
  4. create index.php and create drop down language selector
  5. include the correct language file dependant on the selected language (stored in session data)
  6. substitute your static bits of text with the relevant definition call
  7. Enjoy your multi language website :)

OK lets get started…

1. create languages folder in your web root (or wherever you want on your web server)

OK im going to recommend creating a new folder in your website root called languages. This will be used to hold all your language definition files.

 

2. create english.php definition file

I’m using English as my example but name this after one of the languages you require and create the blank file called english.php in the languages folder.

 

3. create definitions within that file, one for each static piece of text

Edit the new language files in your editor of choice and add the following code (use your own names to define areas on your site you get the idea) 

<?php
define
(“agHeader”“Hello im a title”, true);
define(“agNavigationLink”“Hello im a link”true);
?>

 save the file. Now make a copy of this file in the same folder and call it for example “polish.php” and keep the definition names the same THIS IS CRUCIAL. Change the values though to the new language see below for a polish example!

<?php
define
(“agHeader”“Czesc jestem tytuł”, true);

define(“agNavigationLink”“Czesc jestem hyperłączność”true);
?>

 4. create index.php and create drop down language selector

Create a new index.php file outside of the language folder and within it we need to have a drop down list to select the language we require. Once this is selected we also need to store the language so that when we navigate away from the page the settings are remember. For this we will use sessions.

My Dropdown box code is like this: 

<form action=”<?php echo $_SERVER['PHP_SELF']; ?>” method=”post”>
    <select name=”language”>
        <option value=”english”<?php if($_SESSION['language']==”english”){ echo ” selected=selected”; } ?>>English</option>
        <option value=”polish”<?php if($_SESSION['language']==”polish”){ echo ” selected=selected”; } ?>>Polish</option>
    </select>
    <input type=”submit” value=”Change” name=”submit” />
</form>

this will submit to itself when a language is selected and as you can see, it will automatically start at the current language using a quick check on the SESSION variable we are going to use.

 

5. include the correct language file dependant on the selected language

At the very top of the file i have started the session and done a couple of things. First check if the language has been posted via the form, if it has then it will be stored in a session variable. The next thing that is done is using the session data the language definition is included using a switch statement and not the form data directly for security reasons. We also use the PHP5 filter_input() function to be safe when setting the session data.

This is the code:

<?php
session_start();
if(isset($_POST['language'])){
 $_SESSION['language']= filter_input(INPUT_POST, ‘language’, FILTER_SANITIZE_SPECIAL_CHARS); //filter the posted data just for security
}

switch ($_SESSION['language']) {
 case “polish”:
  include(“languages/polish.php”);
  break;
 default:
  include(“languages/english.php”);
}

?>

6. substitute your static bits of text with the relevant definition call

Last step where you want your text to appear you simple echo out your definitions like so

<?php echo agHeader; ?>

7. Complete!

Thats it!! Below i’ve given a link to the example files and an online demo.

If you do download the example please comment and give feedback as i want to make my blog’s as useful as possible for everyone. If you need any more info or help just ask! I always have time for people if you are keen to learn :)

 Please comment on the article and if you like it link back to me and digg it! 

All feedback welcome, thank you

 

If you would like to download a basic example then please do so here

If you would like to view the online demo go here