0510ML Projects and portfolio

24Feb/100

Dynamic Stylesheet switching

I've recently been in need of a function that dynamically were able to switch stylesheets without reloading the page.
After a lot of searching, I found a post by Rob Glazebrook.

After modifying it a little to my needs, my theme switcher is working like a charm.
You'll need jQuery and jQuery Cookie plugin.

Maybe this post can save you some work and a lot of searching if you need such a feature too ;)

Filed under: PHP, TULM No Comments
12Feb/100

Character encoding

When working on the Food Library for TULM I ran into a problem with character encoding. All æ, ø and å's were being transformed into wierd looking characters.
I needed a way to fix this issue, without the use of str_replace or something similar, since I was retrieving HTML pages with more than 4,000 lines - which would make the str_replace on 10 pages pretty resource intensive.

After looking on the InterGoogle, I found a good solution. PHP comes with a function called iconv.
The syntax for this function is

iconv ( string $in_charset , string $out_charset , string $str )

and by using the following code, this solved my problem and displayed all characters exactly as i wanted them.

$txt = iconv('UTF-8','ISO-8859-1',$txt);

I hope this will be useful to some, so you can avoid going emo due to wrong character encoding from remote sources ;)

12Feb/100

TULM – A little progress

After a few weeks of almost no progress due to homework, a well earned holiday, unfortunately only a week - better than nothing though.

Last night I started on the library that's going to take care of the food ordering service (only available in Denmark in the beginning).
At it's current stage, it's able to query Just-Eat.dk for restaurants in a given zip code and return those.
When one is selected, the menu is retrieved - formatting of the returned menu is the next thing on the todo list.

Alot of things is planned for the upcoming week and we, me and THP44, estimate that in the beginning of the following week (week 8), we'll be at a 50%-ish completion rate - we're currently at 28%.
The planned modules and features planned for coding next week includes, but is not limited to:

  • News
  • Music player with YouTube intergration
  • Food ordering
  • Seat reservation
  • Caffeine ranking

Our timeschedule for TULM can be found in the link below, please note that parts of the file is written in danish.
TULM Timeschedule

Some of the libraries made for TULM, may be released on this site at a later stage for people interested in the same features TULM is using.