Showing posts with label php. Show all posts
Showing posts with label php. Show all posts

Tuesday, 11 October 2011

CodeIgniter / Bonfire

I have been progressing an automated way of generating maps from openstreetmap data, allowing layers to be selected, including contours and hill shading etc. (https://github.com/jones139/disrend).

I want a web front end to allow people to generate maps using this renderer.   When I did this for my townguide program I just built a very simple php based web interface.
Ideally I would like things like user authentication though, which would mean writing a lot of code to go with it.
The CodeIgniter framework goes some way to this by providing an interface to sessions etc, but there is still quite a bit of boilerplate code to write to produce the database interface.
The CodeIgniter / Bonfire application seems to solve this by providing:

  1. Roles based authentication.
  2. Modular structure (this was an issue I had with codeigniter - you ended up with code scattered in different places).
  3. A really neat module builder function that produces a basic module with database interface for you to build on.
I am just trying to get the hang of using bonfire now - I have had a few issues with installing modules based on the module builder code - will write up how to do this once I have it working...

Sunday, 6 March 2011

Emacs Drupal Mode

I am trying to learn how to write Drupal modules for a new map rendering on demand web service (a bit like townguide, but distributed with a separate front end and rendering servers).

First thing is to get emacs23 working with php and drupal modes - the instructions here give me obscure errors about c-lang-def only being used in a file.   After a bit of hunting on the internet I found it is a problem with Emacs V23, and a simple work around is to put the php-mode.el and drupal-mode.el files in ~/.emacs.d, then add the following to ~/.emacs:
; make sure the target directory is on your load-path
(add-to-list 'load-path "~/.emacs.d")
(autoload 'php-mode "php-mode" "Major mode for editing php code" t)
(autoload 'drupal-mode "drupal-mode" "Major mode for editing drupal php " t)
(add-to-list 'auto-mode-alist '("\\.\\(module\\|test\\|install\\|theme\\)$" . drupal-mode))
  (add-to-list 'auto-mode-alist '("\\.\\(php\\|inc\\)$" . php-mode))
  (add-to-list 'auto-mode-alist '("\\.info" . conf-windows-mode))
With that in my .emacs file, loading a .php or .module file starts php or drupal mode - success!

Sunday, 3 January 2010

Town Guide Progress

The good thing about so much bad weather over Christmas was that I could do some nerdy work rather than going out walking or cycling.....
The town guide Python project has therefore made good progress. The program can now generate a PDF 'poster' that can include a street index, and labelled features from the map database (pubs, shops, tourist attractions etc.). A typical example is shown at http://www.townguide.webhop.net/example1_hartlepool.pdf.

I have set up a very rudimentary web service using a PHP script to call townguide.py to generate a town guide on demand at http://www.townguide.webhop.net. It is running on a very small computer, and there is no queue, so there is no saying what will happen if more than one person tries to use it at once - that is another job!