Category Archives: PHP

Primal Screen website launch

Did I mention that our new website launched? Primal Screen website (100% of code and 75% of design by yours truly). Oh, and I’ll never write another website in that bloated carcass of a useable PHP framework: Zend Framework. My … Continue reading

Posted in Actionscript/Flash, CodeIgniter, HTML/CSS, HTML5, Javascript, jQuery, PHP, Zend | Tagged , , , , , , , , , | Leave a comment

Basics: What PHP version does my server run?

If you can’t find the PHP version by logging into your web hosting control panel, or if you just want to find it out the geeky way, by asking the server itself, here’s how. 1. Make a new php file. … Continue reading

Posted in HTML/CSS, PHP | Tagged , , , , , , , | Leave a comment

Getting the current Zend Controller or Method/Action

I already wrote a post about how to do this same thing in CodeIgniter (my PHP framework of choice), but what about Zend (a HUGE, bloated, hard to follow framework I don’t really like, but have to work in). The … Continue reading

Posted in PHP, Zend | Tagged , , , , , , , | Leave a comment

CodeIgniter + DreamHost + subfolder + .htaccess problem?

I moved DreamHost earlier this week, and so far, it’s been great. SVN built into the hosting is fantastic, and the UI in their control panel is much easier to use than the various CPanel implementations most hosts use, and … Continue reading

Posted in CodeIgniter, PHP | Tagged , , , , , , , , , , | Leave a comment

Make your own live, auto-updating data feed with PHP (CodeIgniter) and Javascript (jQuery)

EDIT: I guess you don’t need to store the last entry time in a cookie, storing it in a simple js var works fine. I’ve updated the code to reflect this. EDIT2: If your server isn’t doing a good job … Continue reading

Posted in CodeIgniter, Javascript, jQuery, PHP | Tagged , , , , , , , , , , , , , , , , , | 1 Comment

Simplest Loop for running code n Times

Actionscript/Javascript: var n = 10; while (n–) { // looped code } PHP: $n = 10; while ($n–) { // looped code }

Posted in Actionscript/Flash, Javascript, PHP | Tagged , , , , , , , , , , | Leave a comment

Using PHP to generate your CSS Stylesheets (or .JS files)

So maybe you want to just declare a variable once in PHP at the top of your stylesheet: $theColor = “#363636″; And then when you need to refer to it a dozen times, spread throughout your stylesheet, you can, and … Continue reading

Posted in CodeIgniter, HTML/CSS, Javascript, PHP, Zend | Tagged , , , , , , , , , | Leave a comment

CodeIgniter Rejecting Ajax XMLHttpRequest from jQuery?

I have a javascript/jQuery ajax function that tries to post some data to a URL in my CodeIgniter installation, and it fails. Looking at the console it gives me this message XMLHttpRequest cannot load http://www.DOMAIN.com/chris/calendar/async/update/assignment/325. Origin http://DOMAIN.com is not allowed … Continue reading

Posted in CodeIgniter, HTML/CSS, Javascript, jQuery, PHP | Tagged , , , , , , , , | Leave a comment

CodeIgniter Active Record aliasing column names to prevent overwriting (especially columns named id)

On a recent project I set up all my tables so that they had a primary key, auto-incrementing column named id. I figured this was a good practice, since it meant that all update queries could just reference the id … Continue reading

Posted in CodeIgniter, PHP | Tagged , , , , , , , , , | 3 Comments

Getting the current CodeIgniter Controller or Method/Action

Gets the current controller: $this->router->class; Gets the current method/action: $this->router->method; I like to use these to automatically import a CSS stylesheet to every page. Something like this: <?=link_tag(site_url(‘css/’.$this->router->class.’.css’));?> <?=link_tag( site_url(‘css/’.$this->router->class.’/’.$this->router->method.’.css’) );?> Which ends up looking like this: <link href=”http://www.chrissilich.com/css/controllername.css” rel=”stylesheet” … Continue reading

Posted in CodeIgniter, PHP | Tagged , , , , , | 3 Comments