Mike Karthauser
I work predominantly in PHP using CakePHP MVC Framework on Mac OS X and FreeBSD.
I have worked in the web Industry since 1998 and have contracted for many companies across Bristol and Southern England through as the company Brightstorm Limited.
Posts
I tend to keep my public_html folder at the same level as app folder when working in cakePHP.
Croogo is set up to serve the webroot folder from inside the app folder by default, so if you move your public_html directory then you’ll also need to ensure your file uploads still work.
look in app/views/helpers/image.php
and change the $fullpath and $url to match your directory path.
mine is
$fullpath = ROOT.DS.WEBROOT_DIR.DS.$uploadsDir.DS;
$url = ROOT.DS.WEBROOT_DIR.DS.$path;
i’ve been looking into wildcards for visibility paths primarity so I can add a block into my news/view page without specifying all my news articles.
inside blocks function within croogo component, there is a query which checks the url:
'Block.visibility_paths LIKE' => '%"' . $this->controller->params['url']['url'] . '"%',
obviously, adding news/* wont match so no block in this instance.
The solution I settled on was to modify the conditions and add another check:
I replaced:
'conditions' => array(
'Block.status' => 1,
'Block.region_id' => $regionId,
'AND' => array(
array(
'OR' => array(
'Block.visibility_roles' => '',
'Block.visibility_roles LIKE' => '%"' . $this->roleId . '"%',
),
),
array(
'OR' => array(
'Block.visibility_paths' => '',
'Block.visibility_paths LIKE' => '%"' . $this->controller->params['url']['url'] . '"%',
//'Block.visibility_paths LIKE' => '%"' . 'controller:' . $this->params['controller'] . '"%',
//'Block.visibility_paths LIKE' => '%"' . 'controller:' . $this->params['controller'] . '/' . 'action:' . $this->params['action'] . '"%',
),
),
),
),
With:
'conditions' => array(
'Block.status' => 1,
'Block.region_id' => $regionId,
'AND' => array(
array(
'OR' => array(
'Block.visibility_roles' => '',
'Block.visibility_roles LIKE' => '%"' . $this->roleId . '"%',
),
),
array(
'OR' => array(
array('Block.visibility_paths LIKE' => '%"' . $this->controller->params['url']['url'] . '"%'),
array(
'Block.visibility_paths LIKE' => '%"' .
'controller:' . $this->controller->params['controller'] . '/' .
'action:' . $this->controller->params['action'] . '/'.
'type:' . $this->controller->params['named']['type'] .
'"%',
),
),
),
),
),
This then allows the addition of the following in visibility paths
controller:nodes/action:view/type:news
to get our result.
I’ve given a lot of files that once were in a mercurial repository but now need adding into another one.
Like with svn, mercurial file trees have hidden folders containing details about the commit history. If these get added into a new repo, things stop working properly.
The trick is to recursively delete these folders then all is good.
// find and remove .hg files in the filesystem
find . -name ".hg" -exec rm -rf {} \;
// works with svn files as well
find . -name ".svn" -exec rm -rf {} \;
Croogo is a free and open source content management system, built on top of CakePHP framework.
A little tweak to your .htaccess file in Croogo will get your css serving correctly from within your themes directory.
Look in your webroot/.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
And amend to:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
Options -MultiViews
A neat bit of javascript which allows you to view html source on an iPad or iPhone.
javascript:(function(){
var w = window.open('about:blank'),
s = w.document;
s.write('Source of ' + location.href + '');
s.close();
var pre = s.body.appendChild(s.createElement("pre"));
pre.style.overflow = 'auto';
pre.style.whiteSpace = 'pre-wrap';
pre.appendChild(s.createTextNode(document.documentElement.innerHTML));
})();
Just copy and save as a bookmarklet on mobile safari.
All credit for this goes to Rob Flaherty at Ravel Rumba.
For more details and a link to the bookmarklet – visit http://www.ravelrumba.com/blog/ipad-view-source-bookmarklet/
Something pretty useful in the CakePHP right now is VirtualFields.
A virtual field is a way to combine several fields to make a new ‘virtual’ one that exists when you read from the model. So with ‘firstname’ and ‘surname’ you can make a ‘full_name’ field which will allow you to use this within a find(‘list’) – a notoriously tricky task otherwise.
To do this on the User Model for example, just add the following to your app/models/user.php.
var $virtualFields = array(
'full_name' => 'CONCAT(User.firstname, " ", User.surname)'
);
Simple and powerful.
Available in CakePHP 1.3.*
Wilkinsons is a shop selling low priced general hardware, pharmacy and sundries.
On a trip recently we discoved that Wilkinsons have updated their own brand product labelling. The update has produced a charming and playful set of labels which we were so delighted with that we went round the store hunting for the new labelling, some of which included below.
complete food for adult working and sporting dogs
To see more, check out my flickr set.
By default, results returned by the Google Base data API are sorted according to relevancy. You can change the order by using the orderby parameter. Possible values for this parameter can be found here:
http://code.google.com/apis/base/snippets-feed.html#Parameters
I’m particularly interested in returning the lowest price first which can be achieved by adding the following:&orderby=price(float%20GBP)
to your base query.
to change sort order,
&sortorder=descending|descending
For more information about format and implementation
http://code.google.com/apis/base/samples/javascript/javascript-sample-autosmasher.html
Updates
-
@t1mmyb yup. Was Sunday week ago before it snowed. Massively dark kept the traffic sensible. Much more relaxing keeping the speed down too
-
@t1mmyb gradually improving mpg the more i focus. Got 51mpg on last trip back from andover - mix of B.A amd motorway
-
@t1mmyb i'm driving a diesel estate. thats the terrain of beards and cruise control. currently getting 45+ gallon.
-
@t1mmyb i do. at 70 mph in the left lane for optimum fuel efficiency and consideration for other road users.
-
don't worry twitter, i am not buying an audi.
-
@danhilton a delayed response to a #bathcamp comment i made yesterday in jest.
-
trading my golf in for an audi (cc @dmje)
-
Bedtime. http://t.co/7TZT04IX
-
@segpub anybody there?
-
@cskly exciting stuff. Particularly if you discuss football
-
RT @m1ke_ellis: Bloody brilliant Bathcamp, thanks loads @alancolville @mrjoe @richardcaddick @waringdesign - ace +1
-
@suzicatherine looks like I'm on the 1849 now. Or will be. (cc @benlumley )
-
@mckelvaney we should get a rematch on the bowling for a @mildbunch night out. In Bristol. #bristolcamp
-
@suzicatherine you training it out? Im heading for the 1830 to #bathcamp
-
@benlumley yup. am thinking HKD if its still there. will check my travel arrangements and get back to you later for timingingings
-
@benlumley yup will be. not decided whether i'm driving or getting the train out later.
-
@benlumley you #batchamping later?
-
@fatelvis if you can wait till the 22nd, lifecycle uk has a bike sale in town http://t.co/alJwE5Jw
-
@jimksupertramp of course you can bro.
-
@robmanuel why not 'share this on your wall'?
Posts
Motorbike Dance
“At Magny-Cours, during a round of the promosport Championship: two riders crash and their bikes lock wheel bars and continue to pirouette on the ground.”
Sports Photographer Combines Entire Events into Single Images
“German photographer Peter Langenhahn has specialized in capturing a particular aspect of sports events in a single photo collage. Langenhahn takes as many as three thousand pictures and then puts them together on his computer to create a single image. One of his compositions documented all the fouls in a football match.”
Jane is a famous British comic begun during WWII to improve troop morale. Jane is a plucky English lady who always seems to lose her clothes. This strange predeliction was enough to keep the boys happy and helped them defeat the Gerries. With constant changes of illustration style, the comic persisted into the 1960s. Of course the pill and the sexual revolution made the strange innocent little cartoon completely irrelevant, and that was the end of Jane.
He’ll Look So Great His Grandma Won’t Recognize Him!
[World Of Wonder, via Neatorama]
this weeks development work has been brought to you by angry cat. credit to google search where i found him.
Good people, unfortunately due to circumstances beyond our control, the “clean” version of our new album, The Hot Sauce Committee pt 2 has leaked. So as a hostile and retaliatory measure with great hubris we are making the full explicit aka filthy dirty nasty version available for streaming on our site. We hope this brings much happiness, hugs, and harmony. Enjoy Kikoos for life!
Thank you,
The Management