scriptygoddess

Archive for the ‘Scripts’ Category

A recent project I've been working on involved a portfolio page that required a "carousel" type browser. It also needed to have multiple rows (so that images could be grouped into various projects). Also, because this page would contain a large number of images, it was required that the images not be loaded until you [...]

13 May, 2008

Proportional Scaling Calculator

Posted by: Jennifer In: Javascript| Scripts

I'm sure this has been done before since it's pretty simple – I just couldn't find it quick enough when I needed it. And since it is so simple, it was easier to just create my own personal little calculator than dig around, find one, bookmark. (or worse yet, do the math on a little [...]

13 Feb, 2007

Store Locator using PHP and AJAX

Posted by: Jennifer In: PHP| Scripts

Well, this was fun! I just made a store locator for a client using PHP and AJAX!
I was basically following the instructions from this page: SomeCoders.com (Retrieving database information with AJAX, PHP and MySQL)
Take a look…

09 Feb, 2007

Force File Download

Posted by: Jennifer In: Bookmarks| PHP Related| Script snippet| Scripts

How to force a file to download (without having to zip it up).
$filename = "secure/writeToFile.doc";
header("Content-Length: " . filesize($filename));
header('Content-Type: application/msword');
header('Content-Disposition: attachment; filename=writeToFile.doc');
readfile($filename);
a few other content types – lots more at the above link…
"pdf": "application/pdf"
"zip": "application/zip"
"xls": "application/vnd.ms-excel"
"ppt": "application/vnd.ms-powerpoint"
"gif": "image/gif"
"png": "image/png"
"jpg": "image/jpg"
"mp3": "audio/mpeg"
"mp3": "audio/mp3"
"wav": "audio/x-wav"
"mpe": "video/mpeg"
"mov": "video/quicktime"
"avi": "video/x-msvideo"

This is one of those things I use all the time but because I can't remember things like this, I always have to look for the exact code to do it…
This will take all the values submitted in a form and store them in a session:
foreach($_POST as $k=>$v) {
$_SESSION[$k]=$v;
}
And when you're ready to dump the [...]

I needed to set the selection of a drop down menu. As far as I can tell, if you don't know the "index" value, then you just have to loop through to set the item as selected. If there's an easier way to do this, please speak up in the comments. I spent WAY too [...]

29 Jan, 2007

Get current URL with PHP

Posted by: Jennifer In: Script snippet

Because I was having a "duh" moment.
$_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]

23 Dec, 2006

Decoder Button

Posted by: Jennifer In: Scripts| WordPress Plugins

Had to create a plugin. Guess this means I'm getting back in the groove. ;P Referring back to these posts, this plugin will make a button on your edit post/page making it possible to paste some code you wanted to show, select the code, then click "decode" – which will convert your < to &lt; [...]

Still on hiatus but wanted to post a little javascript (mainly for my future reference) I've used a few times in various applications.
One function will clear the "default" text in a field when the user clicks into it. The second function will replace the default text in the field if the field was [...]

Comments Off

19 Oct, 2004

gifs that execute a php script

Posted by: Jennifer In: Lessons learned| Script snippet

Problem: (somewhat in line with my last post) I needed to run a script in the "background", but I only had the ability to present the script as a .gif.
Solution: actually, I came up with two ways of doing this and both use .htaccess to pull it off.
1) I'm a gif but really I'm a [...]


Featured Sponsors


  • jerey: how do i rewrite this because it tried RewriteEngine on #Options +FollowSymlinks RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FIL
  • Jennifer: So I was testing this out to see if maybe something changed in the latest version - I had a test wordpress setup - and just dumped the mycomment funct
  • KDesign: Hi, thanks for the tutorial. I'm having problems though that I can't seem to find an answer to on the web. When I follow the example in the Codex h

About


Advertisements