Articles tagged 'php'

Blog Projects

HTML5 Drag and Drop Multiple File Upload

Previously I experimented with drag and drop file upload with Google Gears. Recently FireFox 3.6 (codenamed Namoroka) was the first to implement File API. It enables JavaScript to interact with local files.

Correction: Ionut G. Stan pointed out that File API was actually available already in FireFox 3.0. What Namoroka introduced is the drag and drop interface for the files. Sorry for the confusion.

Here is how you can implement drag and drop multiple file upload with native JavaScript. No plugins needed. Just plain old new HTML5. Again there is a working demo. You will need FireFox 3.6 to test it. Full source code can be at GitHub.

Continue reading >>

Drag and Drop File Upload With Google Gears

Google Gears is an extension which adds new features to you browser. It lets your browser to interact with the desktop. You can store data locally to an SQLite based database. Browser will also have a worker pool for running JavaScript code on the background.

Update 20091007: I updated the tutorial and demo to support dragging and dropping multiple files for uploading simultaneously.

Below is how you can do basic drag and drop file upload. Gears, PHP and jQuery are needed. If you want to try there is a working demo. All source code for the demo can be found from GitHub.

Continue reading >>

Logging API for Frog Dashboard

Dashboard plugin for Frog CMS now provides simple API for other developers to log their events. Whenever you want to log something to dashboard just trigger a log event. Include your message as parameter.

Observer::notify('log_event', 'Something was done by :username.');

In your message you can include string :username to log the user name.

Continue reading >>

Mephisto Style Asset Management for Frog CMS

One of the things I like about Mephisto is the asset management. Especially the way how you insert image URLs by dragging thumbnail from sidebar to content area. Frog CMS lacked easy way for inserting images (or any other files). Obvious thing to do...

Continue reading >>

Send Emails from Frog CMS

I needed a mailer backend which can handle complicated forms with any number of arbitary form fields. I also needed to be able to fully control the layout of sent emails. Something similar as oldie but goldie cgiemail.

Here comes Email Template plugin...

Continue reading >>

Email Templates for Frog CMS

Email Template is a plugin for Frog CMS. It provides new page type named Email template. You can use these pages as POST target to your forms. You have full control on the layout of the email sent.


Copy files to frog/plugins/email_template/ folder. If you do not have access to Git use this download link instead. Local installation file might come bit behind GitHub. So if you want bleeding edge use git clone.

cd frog/plugins/
git clone git:// email_template

Go to admin and enable Email Template plugin.

Sending Mail

First you have to create a form. Lets create simple example contact form. Create a page named Contact and paste following HTML code as content of the page.

<form method="post" action="/contact/template">
  Name:    <input name="name" type="text" /><br />
  Company: <input name="company" type="text" /><br />
  Email:   <input name="email" type="text" /><br />
  <textarea name="message"></textarea>
  <input type="submit" />

Continue reading >>

Ultrafast Frog With Funky Cache

Funky caching is technique popularized by site. It was first mentioned by Rasmus Lerdorf in 2002 PHPCon slides (page 25). Content is cached as static file on the first access. All following requests are served using the cached static file. Editing a page will automatically expire cached files. Page is then re-cached on the next hit.

Frog CMS is PHP port of Rails based Radiant CMS. Radiant is great but there is always the hosting problem. Even with mod_rails existing it is still easier to get quality PHP hosting. Both Frog and Radiant are the only CMS’es I can say I like. Expression Engine I can live with. Edicy looks really promising. Everything else I rather not touch.

Continue reading >>

Introduction to Marker Clustering With Google Maps

Static Maps API has URL length limit of around 2048 characters. You can hit this limit quickly when adding lot of markers. You can keep URL short by clustering markers together.

Square Based Clustering

Clustering is usually done by dividing map to squares. Square size depends on map zoom level. Markers inside a square are then grouped into cluster. This technique has some limitations. Look at the following image.

Two markers are close to each other. In fact they are so close they are overlapping. Both markers are also the only marker inside their square. Because markers are in separate square they wont be clustered.

Continue reading >>

Simple Zoom and Pan Controls With Static Maps

Most of the code from previous Static Maps experiments is now put into one clean package. Previously I showed you how to work with markers and bounds. Now we go forward and add zoom and pan controls. It takes only few lines of code. If you just started reading the series check the theory how it works. As a bonus lets add infowindows / bubbles too.

Note! Image above is just a screenshot. You can test final result in the demo.

Create Map and Some Markers

Start by creating new map object and set the size. We also need to give our API key. Markers are positioned on map using location object. Location can be latitude and longitude represented by Google_Maps_Coordinate object. Location can also be map x and y represented by Google_Maps_Point object.

Continue reading >>

Simple Static Maps With PHP

Lately I have been playing with Google Static Maps API a lot. Writing the same things again and again is tedious job. I decided to put the code together as one clean extendable package. Writing object oriented interface for generating URL is trivial. Real meat is having working zoom and pan controls on static map with just 9 lines of code (demo now includes also clickable markers and infowindows).

Code is still alpha quality. API might change any time. But here is a quick walkthrough of current features. We will build the map you see above step by step.

Continue reading >>

Debugging PHP With Firebug

HEADS UP! This article was written in 2007. It exists mostly for historical reasons. You might want to check modern solutions such as Clockwork extension for Chrome.

Logging PHP and JavaScript errors to same window makes debugging easier. It also might be the cure to cancer and bring world peace. In general

Continue reading >>

Built using the awesome Flat UI Pro framework by Designmodo.

© 2016 Mika Tuupola.