HolisticNetworking.Net: Thomas Belknap's Laboratory of LAMP

Thomas J Belknap’s Laboratory of LAMP

 

SyntaxHighlighter Evolved

I’m a big fan of Viper007Bond’s plugins, so when I saw he was releasing a new version of his SyntaxHighlighter, I had to give it a go. Especially for this website, it’s always been a challenge to find just the right code highlighter to properly display my code. What follows is an experiment with the new plugin, based on some CakePHP code I’ve been working on.

<?php
class MetrosController extends AppController {

	var $name = 'Metros';
	var $helpers = array('Form');
	var $components = array('Uuid', 'Cookie');
	var $uses = array('Metro', 'Pothole', 'Town');

	// Cookies:
	var $cookieName = 'PHpatrol';
	var $cookieKey = 'has82js737hak2';
	var $cookieDomain;
	// Add domain name dynamically:
	function __construct() {
	    parent::__construct();
	    $this->cookieDomain = '.'.$_SERVER['SERVER_NAME'];
	}

	function index()
		{
			 $this->set('metros', $this->Metro->find('all'));
			 print_r($this->Cookie->read());
		}

	function add()
		{
		if (!empty($this->data['Metro']))
			{
				$this->data['Metro']['ID'] = $this->Uuid->generate();
				if($this->Metro->save($this->data['Metro']))
					{
						$this->flash('Your Metro has been updated.','/metros/');
					}
			}
		}

Looks good! I’ve thrown some random highlighting in there just to see how it works.

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

No comments or trackbacks yet.

  • [[Your comment goes here!]]
Leave a comment or send a note
  1. (required)
  2. (valid email required)
  3. (required)
  4. Send
  5. Captcha
 

cforms contact form by delicious:days

400x80-banner.png