category

professional dilettante

php

How to pass parameters as a query string to your PHP functions

In PHP, arrays are often used to pass parameters to functions so we don’t have to worry about the order or number of params. But there’s a simpler way to pass a series of key=>value pairs without typing out the structure of an array each time: use a query string.

Continue Reading »

WordPress Shortcodes, Actions, Events Manager, TweetBlender

I’m working on a WordPress project which uses David Benini’s “Events Manager” plugin. The events manager plugin does not use WordPress’ posts for Events. Instead it creates an page with the title “Events”, whose URL would be http://yourdomain.com/events. The content rendered on this page varies. The plugin uses the query string to fetch a single event [...]

Continue Reading »

wordpress theme options error – You do not have sufficient permissions to access this page

If you’re developing an Admin interface for your WordPress Theme or Plugin, and you get this error: You do not have sufficient permissions to access this page It has always been my experience that this error is thrown because the paths in your theme or plugin’s URLs are off. Maybe you are hacking someone’s plugin [...]

Continue Reading »

Using PHP Variable Variables With Form Data

A nice technique I discovered last week, mostly because I am lazy. Typically when handling form data with PHP, you need to create variables one by one, plucking values out of the PHP superglobal associative array, $_POST. For each form field whose value you want to validate and store, we usually declare variables and assign [...]

Continue Reading »

php -a (irb like tool for php)

from terminal, you can type [ ~ ]$ php -a Interactive mode enabled Then you’re free to try things out just like you would with Ruby in IRB or python in ipython. Only thing is you still have type the php tags… But I am finding it useful for trying things out.

Continue Reading »

Most Recent Post

create a file from content on your clipboard

You’re on github or something, reading code. You need to add some code to your project. You could: curl or wget the file URL clone the repo, extract single file, move it on file system create the file, open an editor, and paste in the content save as Here’s a terminal command I like. From [...]

Categories

Content © professional dilettante
Proudly powered by WordPress
Theme designed by Artisan Themes

Entries (RSS)
Comments (RSS)

27 queries.
1.669 seconds.