<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>scriptygoddess &#187; Lessons learned</title>
	<atom:link href="http://www.scriptygoddess.com/archives/category/lessons-learned/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scriptygoddess.com</link>
	<description></description>
	<lastBuildDate>Wed, 13 Jan 2010 17:57:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>swfobject &#8211; flash doesn&#039;t load in Firefox</title>
		<link>http://www.scriptygoddess.com/archives/2009/12/16/swfobject-flash-doesnt-load-in-firefox/</link>
		<comments>http://www.scriptygoddess.com/archives/2009/12/16/swfobject-flash-doesnt-load-in-firefox/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 18:17:43 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Lessons learned]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1627</guid>
		<description><![CDATA[Ran into a bizarre problem today using swfobject. A lot of wasted time, but I&#039;ll give you the short story / solution.
I&#039;m not sure of what other factors played a role (the fact that the element was in a absolute positioned container, or that the immediate container to the flash element was in a float) [...]


Related posts:<ol><li><a href='http://www.scriptygoddess.com/archives/2009/03/23/multi-row-carousel-and-image-loader-with-jquery/' rel='bookmark' title='Permanent Link: Multi-Row Carousel and Image Loader with JQuery'>Multi-Row Carousel and Image Loader with JQuery</a> <small>A recent project I&#039;ve been working on involved a portfolio...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Ran into a bizarre problem today using <a href="http://code.google.com/p/swfobject/">swfobject</a>. A lot of wasted time, but I&#039;ll give you the short story / solution.</p>
<p>I&#039;m not sure of what other factors played a role (the fact that the element was in a absolute positioned container, or that the immediate container to the flash element was in a float) but I had the call to the swfobject javascript in the BODY tags of the html (not within the head tags). This was apparently causing Firefox to not display the flash. Simply moving the swfobject javascript code within the head tags of the html instantly fixed the problem.</p>
<p>I know I&#039;ve used swfobject inside the body before &#8211; so I&#039;m sure there&#039;s something else that contributed to the problem.</p>


<p>Related posts:<ol><li><a href='http://www.scriptygoddess.com/archives/2009/03/23/multi-row-carousel-and-image-loader-with-jquery/' rel='bookmark' title='Permanent Link: Multi-Row Carousel and Image Loader with JQuery'>Multi-Row Carousel and Image Loader with JQuery</a> <small>A recent project I&#039;ve been working on involved a portfolio...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2009/12/16/swfobject-flash-doesnt-load-in-firefox/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Image as buttons (and IE issues)</title>
		<link>http://www.scriptygoddess.com/archives/2005/03/07/image-as-buttons-and-ie-issues/</link>
		<comments>http://www.scriptygoddess.com/archives/2005/03/07/image-as-buttons-and-ie-issues/#comments</comments>
		<pubDate>Mon, 07 Mar 2005 21:28:36 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[Lessons learned]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2005/03/07/image-as-buttons-and-ie-issues/</guid>
		<description><![CDATA[Oh, this one was going to drive me NUTS! I had to use images as buttons in a form. That&#039;s easy enough:
&#60;input type="image" SRC="blahButton.gif" ALT="blah" name="blah" id="blah" value="blah" /&#62;
Which works fine when simply submitting the form when there&#039;s ONE button. But on one page I had TWO buttons. The form would submit to itself, and [...]


Related posts:<ol><li><a href='http://www.scriptygoddess.com/archives/2009/03/23/multi-row-carousel-and-image-loader-with-jquery/' rel='bookmark' title='Permanent Link: Multi-Row Carousel and Image Loader with JQuery'>Multi-Row Carousel and Image Loader with JQuery</a> <small>A recent project I&#039;ve been working on involved a portfolio...</small></li>
<li><a href='http://www.scriptygoddess.com/archives/2009/06/17/wordpress-2-8-issues/' rel='bookmark' title='Permanent Link: Wordpress 2.8 Issues'>Wordpress 2.8 Issues</a> <small>In case you hadn&#039;t heard (and if you&#039;re using wordpress,...</small></li>
<li><a href='http://www.scriptygoddess.com/archives/2009/10/27/striping-img-tags-from-the_content-in-wordpress-and-how-to-fudge-page-excerpts/' rel='bookmark' title='Permanent Link: Striping IMG tags from the_content in WordPress (and how to fudge page excerpts)'>Striping IMG tags from the_content in WordPress (and how to fudge page excerpts)</a> <small>Background: For a site I was working on, I was...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Oh, this one was going to drive me NUTS! I had to use images as buttons in a form. That&#039;s easy enough:</p>
<p><code>&lt;input type="image" SRC="blahButton.gif" ALT="blah" name="blah" id="blah" value="blah" /&gt;</code></p>
<p>Which works fine when simply submitting the form when there&#039;s ONE button. But on one page I had TWO buttons. The form would submit to itself, and then depending on which button was clicked, I would handle the form as appropriate. Worked fine in firefox &#8211; nothing happened in IE. I found <a href="http://www.webmasterworld.com/forum21/9694.htm">this page in a search</a>.</p>
<p>What I had been doing was simply (in php)</p>
<p><code>if (isset($_POST["blah"])) {<br />
	//do stuff<br />
} else if (isset($_POST["blahblah"])) {<br />
	//do different stuff<br />
}</code></p>
<p>What fixed the problem was changing that code to this:</p>
<p><code>if (isset($_POST["blah_x"])) {<br />
	//do stuff<br />
} else if (isset($_POST["blahblah_x"])) {<br />
	//do different stuff<br />
}</code></p>
<p>Now my form works&#8230;</p>


<p>Related posts:<ol><li><a href='http://www.scriptygoddess.com/archives/2009/03/23/multi-row-carousel-and-image-loader-with-jquery/' rel='bookmark' title='Permanent Link: Multi-Row Carousel and Image Loader with JQuery'>Multi-Row Carousel and Image Loader with JQuery</a> <small>A recent project I&#039;ve been working on involved a portfolio...</small></li>
<li><a href='http://www.scriptygoddess.com/archives/2009/06/17/wordpress-2-8-issues/' rel='bookmark' title='Permanent Link: Wordpress 2.8 Issues'>Wordpress 2.8 Issues</a> <small>In case you hadn&#039;t heard (and if you&#039;re using wordpress,...</small></li>
<li><a href='http://www.scriptygoddess.com/archives/2009/10/27/striping-img-tags-from-the_content-in-wordpress-and-how-to-fudge-page-excerpts/' rel='bookmark' title='Permanent Link: Striping IMG tags from the_content in WordPress (and how to fudge page excerpts)'>Striping IMG tags from the_content in WordPress (and how to fudge page excerpts)</a> <small>Background: For a site I was working on, I was...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2005/03/07/image-as-buttons-and-ie-issues/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>ASP: Look up / translation script</title>
		<link>http://www.scriptygoddess.com/archives/2004/11/10/asp-look-up-translation-script/</link>
		<comments>http://www.scriptygoddess.com/archives/2004/11/10/asp-look-up-translation-script/#comments</comments>
		<pubDate>Wed, 10 Nov 2004 14:47:15 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[Bookmarks]]></category>
		<category><![CDATA[Lessons learned]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2004/11/10/asp-look-up-translation-script/</guid>
		<description><![CDATA[I should create a category called &#034;saved my ass&#034;! This script would fall under it.
I was asked to create a &#034;look up&#034; tool that would sort of &#034;translate&#034; one piece of text to another. The user would enter in the first piece of text, and then they&#039;d be given the &#034;value&#034;. Oh, and this list [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I should create a category called &#034;saved my ass&#034;! This script would fall under it.</p>
<p>I was asked to create a &#034;look up&#034; tool that would sort of &#034;translate&#034; one piece of text to another. The user would enter in the first piece of text, and then they&#039;d be given the &#034;value&#034;. Oh, and this list updates every few months or so.</p>
<p>At first I started looking into creating a database, and writing a script that would update that database &#8211; problem was that creating and accessing a database for this project was going to be time consuming and difficult. A server-side script would have been the best solution under the circumstances. A few hours this morning searching around turned up <a href="http://www.asptutorial.info/learn/Dictionary.asp">this &#034;dictionary&#034; script</a>.</p>
<p>I&#039;m actually being given the the text and values in excel, so I just need to create a sort of &#034;template&#034; in excel that formats everything so it will look like the code &#8211; and then I just copy and paste it all into the ASP file.</p>
<p>So here&#039;s kind of what I have in my file:<br />
<h3>SET TextToNumber=CreateObject(&#034;Scripting.Dictionary&#034;)<br />
TextToNumber.Add &#034;name&#034;, &#034;292949&#034;<br />
TextToNumber.Add &#034;date&#034;, &#034;123414&#034;<br />
etc. etc&#8230;</h3>
<p>Then my form looks like this:</p>
<h3>&lt;form name=&#034;textlookup&#034; action=&#034;lookup.asp&#034; method=&#034;post&#034;&gt;<br />
Text: &lt;input type=&#034;text&#034; name=&#034;text&#034; value=&#034;" /&gt;&lt;br&gt;<br />
&lt;input type=&#034;submit&#034; name=&#034;submit&#034; value=&#034;Look Up Text Number&#034; /&gt;&lt;/form&gt;<br />
Text: &lt;% Response.Write(Request.Form(&#034;text&#034;)) %&gt;&lt;br&gt;<br />
Number: &lt;%<br />
TextValue=Request.Form(&#034;text&#034;)<br />
NumberValue=TextToNumber(TextValue)<br />
Response.Write(NumberValue)<br />
%&gt;</h3>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2004/11/10/asp-look-up-translation-script/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>PHP: simple logic statement</title>
		<link>http://www.scriptygoddess.com/archives/2004/11/05/php-simple-logic-statement/</link>
		<comments>http://www.scriptygoddess.com/archives/2004/11/05/php-simple-logic-statement/#comments</comments>
		<pubDate>Sat, 06 Nov 2004 01:47:38 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[Lessons learned]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2004/11/05/php-simple-logic-statement/</guid>
		<description><![CDATA[I&#039;m tired of searching for the correct syntax everytime I wan to use this line&#8230; if you&#039;re doing a simple one line &#034;if&#034; statement, you can use a &#034;ternary conditional operator&#034; &#8211; for example:
echo $variable == &#039;value&#039; ? &#039;print if true&#039; : &#039;print if false&#039;;


Related posts:Simple Shortcode for Line Breaks One kind of funny thing [...]


Related posts:<ol><li><a href='http://www.scriptygoddess.com/archives/2009/08/29/simple-shortcode-for-line-breaks/' rel='bookmark' title='Permanent Link: Simple Shortcode for Line Breaks'>Simple Shortcode for Line Breaks</a> <small>One kind of funny thing with WordPress is that entering...</small></li>
<li><a href='http://www.scriptygoddess.com/archives/2009/10/06/conditionally-change-path-to-https/' rel='bookmark' title='Permanent Link: Conditionally change path to HTTPS'>Conditionally change path to HTTPS</a> <small>One of my clients had set it up so that...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I&#039;m tired of searching for the correct syntax everytime I wan to use this line&#8230; if you&#039;re doing a simple one line &#034;if&#034; statement, you can use a &#034;ternary conditional operator&#034; &#8211; for example:<br />
<h3>echo $variable == &#039;value&#039; ? &#039;print if true&#039; : &#039;print if false&#039;;</h3>


<p>Related posts:<ol><li><a href='http://www.scriptygoddess.com/archives/2009/08/29/simple-shortcode-for-line-breaks/' rel='bookmark' title='Permanent Link: Simple Shortcode for Line Breaks'>Simple Shortcode for Line Breaks</a> <small>One kind of funny thing with WordPress is that entering...</small></li>
<li><a href='http://www.scriptygoddess.com/archives/2009/10/06/conditionally-change-path-to-https/' rel='bookmark' title='Permanent Link: Conditionally change path to HTTPS'>Conditionally change path to HTTPS</a> <small>One of my clients had set it up so that...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2004/11/05/php-simple-logic-statement/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Continue vs. Break (in while loops)</title>
		<link>http://www.scriptygoddess.com/archives/2004/10/25/continue-vs-break-in-while-loops/</link>
		<comments>http://www.scriptygoddess.com/archives/2004/10/25/continue-vs-break-in-while-loops/#comments</comments>
		<pubDate>Mon, 25 Oct 2004 17:15:13 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[Lessons learned]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2004/10/25/continue-vs-break-in-while-loops/</guid>
		<description><![CDATA[(note to self type post)
Using &#034;continue&#034; in the middle of a while loop will skip the current iteration and go back to the beginning of the loop (checking the while value again).
Using &#034;break&#034; in the middle of a while loop will break the loop entirely. (no more looping)
So this code
&#60;?php
$i = 0;
while ($i &#60; 5) [...]


Related posts:<ol><li><a href='http://www.scriptygoddess.com/archives/2009/08/28/playing-with-post-attachments/' rel='bookmark' title='Permanent Link: Playing with Post Attachments'>Playing with Post Attachments</a> <small>I&#039;ve been doing a ton of sites recently using WordPress...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>(note to self type post)<br />
Using &#034;continue&#034; in the middle of a while loop will skip the current iteration and go back to the beginning of the loop (checking the while value again).</p>
<p>Using &#034;break&#034; in the middle of a while loop will break the loop entirely. (no more looping)</p>
<p>So this code<br />
<h3>&lt;?php<br />
$i = 0;<br />
while ($i &lt; 5) {<br />
$i++;<br />
	if ($i%2) {<br />
		echo &#034;value = &#034; .$i . &#034; &#8211; inside if&lt;br&gt;&#034;;<br />
		<strong>continue;</strong><br />
	}<br />
echo &#034;value = &#034; .$i . &#034; &#8211; outside if&lt;br&gt;&#034;;<br />
}<br />
?&gt;</h3>
<p>Will produce this:<br />
value = 1 &#8211; inside if<br />
value = 2 &#8211; outside if<br />
value = 3 &#8211; inside if<br />
value = 4 &#8211; outside if<br />
value = 5 &#8211; inside if</p>
<p>Where as this</p>
<h3>&lt;?php<br />
$i = 0;<br />
while ($i &lt; 5) {<br />
$i++;<br />
	if ($i%2) {<br />
		echo &#034;value = &#034; .$i . &#034; &#8211; inside if&lt;br&gt;&#034;;<br />
		<strong>break;</strong><br />
	}<br />
echo &#034;value = &#034; .$i . &#034; &#8211; outside if&lt;br&gt;&#034;;<br />
}<br />
?&gt;</h3>
<p>Will produce this:<br />
value = 1 &#8211; inside if</p>
<p><a href="http://us2.php.net/while">See more about while loops here.</a></p>


<p>Related posts:<ol><li><a href='http://www.scriptygoddess.com/archives/2009/08/28/playing-with-post-attachments/' rel='bookmark' title='Permanent Link: Playing with Post Attachments'>Playing with Post Attachments</a> <small>I&#039;ve been doing a ton of sites recently using WordPress...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2004/10/25/continue-vs-break-in-while-loops/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Button Element</title>
		<link>http://www.scriptygoddess.com/archives/2004/10/25/button-element/</link>
		<comments>http://www.scriptygoddess.com/archives/2004/10/25/button-element/#comments</comments>
		<pubDate>Mon, 25 Oct 2004 13:19:35 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[Bookmarks]]></category>
		<category><![CDATA[Lessons learned]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2004/10/25/button-element/</guid>
		<description><![CDATA[Hello, I&#039;d like to take HTML 101.
So I was working on a form. Used this method to create the form. Minimal HTML. Simple CSS. Started playing around with the :focus pseudo-class&#8230; and that&#039;s when I noticed my submit button started looking crummy. (From a usability perspective, I think there are some things that SHOULDN&#039;T be [...]


Related posts:<ol><li><a href='http://www.scriptygoddess.com/archives/2009/12/16/swfobject-flash-doesnt-load-in-firefox/' rel='bookmark' title='Permanent Link: swfobject &#8211; flash doesn&#039;t load in Firefox'>swfobject &#8211; flash doesn&#039;t load in Firefox</a> <small>Ran into a bizarre problem today using swfobject. A lot...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Hello, I&#039;d like to take HTML 101.</p>
<p>So I was working on a form. <a href="http://www.quirksmode.org/index.html?/css/forms.html">Used this method to create the form</a>. Minimal HTML. Simple CSS. Started playing around with the :focus pseudo-class&#8230; and that&#039;s when I noticed my submit button started looking crummy. (From a usability perspective, I think there are some things that SHOULDN&#039;T be over-styled. Scrollbars, Buttons. People are used to seeing these have the default look of their OS or Browser. Mess with them, and while you may think YOUR design of them looks pretty, they&#039;re probably not as usable anymore.)</p>
<p>So I went searching for a way to revert an element back to it&#039;s default, and basically discovered that it&#039;s not possible. But the search led me to <a href="http://www.ozoneasylum.com/22895">this page</a> where the suggestion was to simply use the &lt;button&gt;&lt;/button&gt; tag instead of &lt;input type=&#034;button&#034; /&gt; <a href="http://www.w3.org/TR/html401/interact/forms.html#h-17.5">W3C says you can even</a> (however, the validate local html through the web developer extension in Firefox is giving me errors on all the attributes, even though they are within spec of the DTD.)</p>
<p>Button element?? Ok, add that to the list of things I probably should have known about but didn&#039;t! :-/</p>


<p>Related posts:<ol><li><a href='http://www.scriptygoddess.com/archives/2009/12/16/swfobject-flash-doesnt-load-in-firefox/' rel='bookmark' title='Permanent Link: swfobject &#8211; flash doesn&#039;t load in Firefox'>swfobject &#8211; flash doesn&#039;t load in Firefox</a> <small>Ran into a bizarre problem today using swfobject. A lot...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2004/10/25/button-element/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>gifs that execute a php script</title>
		<link>http://www.scriptygoddess.com/archives/2004/10/19/gifs-that-execute-a-php-script/</link>
		<comments>http://www.scriptygoddess.com/archives/2004/10/19/gifs-that-execute-a-php-script/#comments</comments>
		<pubDate>Tue, 19 Oct 2004 16:37:59 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[Lessons learned]]></category>
		<category><![CDATA[Script snippet]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2004/10/19/gifs-that-execute-a-php-script/</guid>
		<description><![CDATA[Problem: (somewhat in line with my last post) I needed to run a script in the &#034;background&#034;, 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&#039;m a gif but really I&#039;m a [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Problem: (somewhat in line with my last post) I needed to run a script in the &#034;background&#034;, but I only had the ability to present the script as a .gif.</p>
<p>Solution: actually, I came up with two ways of doing this and both use .htaccess to pull it off.</p>
<p><strong>1) I&#039;m a gif but really I&#039;m a php script</strong><br />
This one is fairly straightfoward. I put my script in a seperate directory, (that doesn&#039;t actually include any images!) and renamed it from filename<strong>.php</strong> to filename<strong>.gif</strong> (or filename<strong>.jpg</strong>) (Yes, I know it&#039;s not really an image file. Hang in there)</p>
<p>Then, in the htaccess file for JUST THAT FOLDER! (similar to <a href="http://www.scriptygoddess.com/archives/2003/04/02/running-php-on-a-html-or-htm-page/">this trick</a>) I added this:<br />
<code>AddType application/x-httpd-php .php .jpg .gif</code></p>
<p>FYI &#8211; in your php file (that now looks like a .gif or .jpg) make sure you don&#039;t have any headers/text echoed, and at the end of the file add this to your php code:<br />
<code>header('Content-Type: image/gif');<br />
@readfile( '/SERVERPATH/TO/A/REAL/IMAGE/spacer.gif' );</code></p>
<p>You can then include the &#034;script&#034; as if it were an image file, it will run the script, but only display a gif to the user.</p>
<p>You can even pass it variables like filename.gif?somevariable=somevalue&#038;anotervariable=anothervalue, but there&#039;s another way to do that too without the ugly URL.</p>
<p><strong>2) I&#039;m a gif that&#039;s actually a php script super-powered with rewrite</strong><br />
Ok, starting from the beginning. You have your script (filename.php) in a folder, add the following to the .htaccess file in that folder:<br />
<code>RewriteEngine On<br />
RewriteBase /<br />
RewriteRule ^(.*)/(.*)/spacer.gif /YOURFOLDER/FILENAME.php?somevar=$1&#038;anothervar=$2 [QSA]</code></p>
<p>Before we continue, I must tell you that I dont&#039; completely understand rewrite rules. There&#039;s a LOT of holes in my knowledge. So if you have a better way, PLEASE post it in the comments. I would LOVE to be able to understand what the hell I&#039;m doing. LOL.</p>
<p>OK, moving along. Now you can call your script by actually calling that &#034;phantom&#034; spacer.gif, with the variables in the URL as if they&#039;re directories like this:</p>
<p><code>http://www.yourdomain.com/YOURFOLDER/somevalue/anothervalue/spacer.gif</code></p>
<p>Again, make sure you have this at the end of you php code in your filename.php:<br />
<code>header('Content-Type: image/gif');<br />
@readfile( '/SERVERPATH/TO/A/REAL/IMAGE/spacer.gif' );</code></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2004/10/19/gifs-that-execute-a-php-script/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Border tricks and centering issues</title>
		<link>http://www.scriptygoddess.com/archives/2004/10/09/border-tricks-and-centering-issues/</link>
		<comments>http://www.scriptygoddess.com/archives/2004/10/09/border-tricks-and-centering-issues/#comments</comments>
		<pubDate>Sat, 09 Oct 2004 23:32:50 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Lessons learned]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2004/10/09/border-tricks-and-centering-issues/</guid>
		<description><![CDATA[I&#039;m working on redesigning a site in CSS that I did many eons ago using tables for Christine. While I&#039;m getting the hang of CSS, I still have a long ways to go.
First of all &#8211; Christine wants a border around her photos: first a thick white one, then a one pixel black one. She [...]


Related posts:<ol><li><a href='http://www.scriptygoddess.com/archives/2009/06/17/wordpress-2-8-issues/' rel='bookmark' title='Permanent Link: Wordpress 2.8 Issues'>Wordpress 2.8 Issues</a> <small>In case you hadn&#039;t heard (and if you&#039;re using wordpress,...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I&#039;m working on redesigning a site in CSS that I did many eons ago using tables for <a href="http://www.bigpinkcookie.com">Christine</a>. While I&#039;m getting the hang of CSS, I still have a long ways to go.</p>
<p>First of all &#8211; Christine wants a border around her photos: first a thick white one, then a one pixel black one. She had previously been doing that with photoshop, but I&#039;ve suggested to her that it would be better to just do it in CSS&#8230; On my first try, I had tried wrapping the img tag in a number of divs &#8211; which not only didn&#039;t really work quite right, it added extra html that didn&#039;t need to be there. The answer was simple. Here is the CSS I used for the border (a class I add to the img tag) :<br />
<h3>padding: 15px;<br />
border: 1px solid #000;<br />
background-color: #fff;</h3>
<p>The other thing I was struggling with was another (should have been) simple issue. I simply wanted a block of text, 600px wide &#8211; centered on the page, but with the text flush left. The key I was missing was adding <strong>margin-right:auto;</strong> and <strong>margin-left:auto;</strong>. So here&#039;s the CSS for the outer div &#8211; and the div for the text block:</p>
<h3>#content {<br />
text-align: center;<br />
}<br />
#text{<br />
width: 600px;<br />
margin-right:auto;<br />
margin-left:auto;<br />
text-align:left;<br />
}</h3>
<p>The only way I was able to figure that out was from looking at the examples on <a href="http://www.maxdesign.com.au/presentation/page_layouts/index.cfm">Max Design: CSS Page Layouts</a></p>


<p>Related posts:<ol><li><a href='http://www.scriptygoddess.com/archives/2009/06/17/wordpress-2-8-issues/' rel='bookmark' title='Permanent Link: Wordpress 2.8 Issues'>Wordpress 2.8 Issues</a> <small>In case you hadn&#039;t heard (and if you&#039;re using wordpress,...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2004/10/09/border-tricks-and-centering-issues/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>ASP: get the name of the current page</title>
		<link>http://www.scriptygoddess.com/archives/2004/10/05/asp-get-the-name-of-the-current-page/</link>
		<comments>http://www.scriptygoddess.com/archives/2004/10/05/asp-get-the-name-of-the-current-page/#comments</comments>
		<pubDate>Tue, 05 Oct 2004 18:18:31 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[Lessons learned]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2004/10/05/asp-get-the-name-of-the-current-page/</guid>
		<description><![CDATA[(Side note: I hate ASP. I love PHP. But sometimes mean people make me use ASP) ;o)
I needed to get the current page name and redirect to a different page if it was a certain name. (ie. 1.asp or 2.asp or&#8230; up to any two-digit + .asp)
First &#8211; to get the page name I used [...]


Related posts:<ol><li><a href='http://www.scriptygoddess.com/archives/2009/06/10/open_basedir-restriction-in-effect-error-on-wordpress-page/' rel='bookmark' title='Permanent Link: open_basedir restriction in effect error on WordPress page'>open_basedir restriction in effect error on WordPress page</a> <small>This is the second time I&#039;ve run into this problem....</small></li>
<li><a href='http://www.scriptygoddess.com/archives/2009/10/27/striping-img-tags-from-the_content-in-wordpress-and-how-to-fudge-page-excerpts/' rel='bookmark' title='Permanent Link: Striping IMG tags from the_content in WordPress (and how to fudge page excerpts)'>Striping IMG tags from the_content in WordPress (and how to fudge page excerpts)</a> <small>Background: For a site I was working on, I was...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>(Side note: I hate ASP. I love PHP. But sometimes mean people make me use ASP) ;o)</p>
<p>I needed to get the current page name and redirect to a different page if it was a certain name. (ie. 1.asp or 2.asp or&#8230; up to any two-digit + .asp)</p>
<p>First &#8211; to get the page name I used a script I found <a href="http://forums.devarticles.com/archive/t-663">here</a>:<br />
<h3>Dim strURL, aryURL, pagename, objRegExp<br />
strURL = Request.ServerVariables(&#034;SCRIPT_NAME&#034;)<br />
aryURL = Split(strURL, &#034;/&#034;, -1, 1)<br />
pagename = aryURL(ubound(aryURL))</h3>
<p>Then I check the page against a reg exp:</p>
<h3>set objRegExp = new RegExp<br />
objRegExp.Pattern = &#034;^[0-9]{1,2}&#92;.asp&#034;<br />
if objRegExp.Test(pagename) then<br />
Response.Redirect(&#034;http://www.example.com/pageToRedirectTo.asp&#034;)<br />
end if</h3>
<p>(FYI &#8211; I&#039;m trying to get a better grasp of regular expressions. I know they&#039;re useful, I just can&#039;t seem to wrap my head around them. We&#039;re still at the &#034;it makes my eyes bleed&#034; stage &#8211; which is also pretty much how I feel about ASP)</p>


<p>Related posts:<ol><li><a href='http://www.scriptygoddess.com/archives/2009/06/10/open_basedir-restriction-in-effect-error-on-wordpress-page/' rel='bookmark' title='Permanent Link: open_basedir restriction in effect error on WordPress page'>open_basedir restriction in effect error on WordPress page</a> <small>This is the second time I&#039;ve run into this problem....</small></li>
<li><a href='http://www.scriptygoddess.com/archives/2009/10/27/striping-img-tags-from-the_content-in-wordpress-and-how-to-fudge-page-excerpts/' rel='bookmark' title='Permanent Link: Striping IMG tags from the_content in WordPress (and how to fudge page excerpts)'>Striping IMG tags from the_content in WordPress (and how to fudge page excerpts)</a> <small>Background: For a site I was working on, I was...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2004/10/05/asp-get-the-name-of-the-current-page/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>OOP in JavaScript.</title>
		<link>http://www.scriptygoddess.com/archives/2004/09/30/oop-in-javascript/</link>
		<comments>http://www.scriptygoddess.com/archives/2004/09/30/oop-in-javascript/#comments</comments>
		<pubDate>Fri, 01 Oct 2004 03:12:07 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[Lessons learned]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2004/09/30/oop-in-javascript/</guid>
		<description><![CDATA[Guest authored by<br />
Sergey Zavadski - <a href="http://www.codethat.com/">codethat.com</a>


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>The article by Sergey Zavadski introduces the object model of the JavaScript programming language and demonstrates common practices in the OOP (object oriented programming) with the JavaScript.<br />
<span id="more-1354"></span><br />
<strong>Simplicity of the JavaScript.</strong><br />
JavaScript is proven to be the one of the simplest programming languages to learn and use. Minor snippet of the code (in fact one string) performs various actions like creating of the windows or changing the text in the status bar. The flexibility, short learning curve and the fact that JavaScript is not &#034;strongly typed&#034; language explains extreme popularity of the JavaScript among the web masters community which selected this language as the language of choice to provide the static HTML pages with the dynamic attractive content. </p>
<p><strong>The powerful tool.</strong><br />
However in spite of its visible simplicity the JavaScript, when following the DOM specifications, is quite advanced and powerful tool providing all the required facilities for the creation of the complex solutions (client side) such as menus, trees, grids. These possibilities are actually reflecting the JavaScript’s power when it comes to the layers manipulations. Not the last reason for this power is OOP structure of the JavaScript programming language which was planned and implemented as an object oriented language!</p>
<p><strong>Object model.</strong><br />
The JavaScript object is the entity with the properties that can be either other objects or variables. For example we have ‘Country_Italy’ object. We can assign the values to the properties of this object like this:<br />
<h3>Country_Italy.Name=&#034;Italy&#034;;<br />
Country_Italy.Capital=&#034;Rome&#034;;<br />
Country_Italy.Area=301000;</h3>
<p>However the &#039;Country_Italy&#039; object itself can be the property of other object:</p>
<h3>Europe.MostBeautifulCountry= Country_Italy;</h3>
<p>JavaScript comes with the library of the built-in objects like &#039;Window&#039;, &#039;Math&#039;, &#039;String&#039; and many others. But what makes the language really flexible is the ability of creating own custom objects. There are two possible methods for making custom objects in the JavaScript. First one is using of the direct initialization. The code in this case may look like this:</p>
<h3>Country={Name:&#034;France&#034;,Capital:&#034;Paris&#034;,Government:{President:&#034;Jacques Chirac&#034;}};</h3>
<p>We have created the Country object with the ‘Name’, ‘Capital’ and ‘Government’ properties and the &#039;Government&#039; property is the object with own list of properties. We’ve also initialized these properties with the initial values. All is done in the one single string. The following construction creates and initializes the empty object:</p>
<h3>Country={};</h3>
<p>Another way to create objects in the JavaScript is defining the special function constructor for the object and initialization of the object with the &#039;new&#039; operator. For example:</p>
<h3>function Country(Name,Capital,Population){<br />
 	this.Name=Name;<br />
 	this.Capital=Capital;<br />
 	this.Population=Population;<br />
}</h3>
<p>The &#039;Country&#039; function is the constructor function. Now to create the object using this defined constructor we use the new operator:</p>
<h3>Country_Italy=new Country(&#034;Italy&#034;,&#034;Rome&#034;,301000);</h3>
<p>Just like in the previous example the property can be the object itself:</p>
<h3>function Government(President){<br />
 	this.President=President;<br />
}<br />
function Country(Name,Capital,Government){<br />
 	this.Name=Name;<br />
 	this.Capital=Capital;<br />
 	this.Government=Government;<br />
}<br />
Government_France=new Government(“Jacques Chirac”); Country_France=new Country(&#034;France&#034;,&#034;Paris&#034;,Government_France);</h3>
<p>Another advantage of the OOP fully implemented in the JavaScript is that the object can have the methods (not only properties). The methods are the functions described within the object scope that usually operate with object’s properties. The methods are described much like the properties:</p>
<h3>function describeCountry(){<br />
  	      var desc=&#034;Name: &#034;+this.Name+&#034; Capital: &#034;+ this.Capital+&#034; Population: &#034;+this.Population;<br />
      	alert(desc);<br />
}</h3>
<p>In the above definition this operator provides an access to the object the described method belongs to.</p>
<h3>Country_Italy.describeCountry=describeCountry;</h3>
<p>The construction below fully repeats the above one:</p>
<h3>Country_Italy.describeCountry=function(){<br />
		var desc=&#034;Name: &#034;+this.Name+&#034; Capital: &#034;+ this.Capital+&#034; Population: &#034;+this.Population;<br />
 	alert(desc);<br />
}</h3>
<p>The construction:</p>
<h3>Country_Italy.describeCountry();</h3>
<p>calls the &#039;describeCountry&#039; method of the &#039;Country_Italy&#039; object.</p>
<p><strong>Prototypes based object oriented language.</strong><br />
Unlike some other popular OO languages (Java, C++) whose object model is based on the classes the object model of the JavaScript is based on the prototypes. The main difference between those two approaches is that in the prototype based language there’s no difference between the class and the class instance entities – you only deal with the objects. </p>
<p>The prototype (can be viewed as a template that defines the way initial object&#039;s properties values are assigned) is any object declared with the prototype operator. This object can be the parent of any newly created object and this is how the JavaScript supports inheritance – important OOP language characteristic. Let’s see our Country object:</p>
<h3>function Country(Name,Capital,Population){<br />
 	this.Name=Name;<br />
 	this.Capital=Capital;<br />
 	this.Population=Population;<br />
}</h3>
<p>Now let&#039;s declare &#039;Cn&#039; &#8211; the &#039;Country&#039; object prototype:</p>
<h3>Cn=Country.prototype;<br />
Cn.describeCountry=function(){<br />
		var desc=&#034;Name: &#034;+this.Name+&#034; Capital: &#034;+ this.Capital+&#034; Population: &#034;+this.Population;<br />
      	alert(desc);<br />
}</h3>
<p>Now we can call the &#039;describeCountry&#039; method in any &#039;Country&#039; descendant with only two strings of code:</p>
<h3>Country_Italy=new Country(&#034;Italy&#034;,&#034;Rome&#034;,301000); Country_Italy.describeCountry();</h3>
<p>Using this approach we can define in the prototype any number of the methods and properties. Defining methods and properties in the prototype rather then defining them directly for each object gives many advantages:</p>
<p>- You don’t have to define all required methods or properties any time the object is created. You define all the necessary methods and properties in the prototype and then all you have to do is to create the object.<br />
- Makes your code more secure since you can keep all object definitions in the separate file<br />
- Makes your code easier to read</p>
<p><strong>Inheritance.</strong><br />
JavaScript also supports the inheritance mechanism that is the corner-stone of the OOP.<br />
To show the easiness of the JavaScript inheritance mechanism let&#039;s review two already defined objects of ours &#039;Country&#039; and &#039;Government&#039; and one new object &#039;Parliament&#039;. Let&#039;s assume that these objects have the following object hierarchy:</p>
<p>Constructor functions for these objects will look like these:</p>
<h3>function Country(Name,Capital,Population){<br />
 	this.Name=Name;<br />
	      this.Capital=Capital;<br />
 	this.Population=Population;<br />
}<br />
function Government(President){<br />
 	this.President=President;<br />
}<br />
function Parliament(Speaker){<br />
 	this.Speaker=Speaker;<br />
}</h3>
<p>Take a look at the &#039;Country&#039; object prototype.</p>
<h3>Cn=Country.prototype;<br />
Cn.describeCountry=function(){<br />
		var desc=”Name: ”+this.Name+” Capital: ”+ this.Capital+” Population: “+this.Population;<br />
	alert(desc);<br />
}</h3>
<p>The following construction defines &#039;Country&#039; as &#039;Government&#039; prototype (&#039;Government&#039; inherits the &#039;Country&#039;):</p>
<h3>Government.prototype=new Country(&#034;France&#034;,&#034;Paris&#034;,59330000);</h3>
<p>When &#039;Government&#039; object is created it inherits all the &#039;Country&#039; methods and properties. In other words, although &#039;describeCountry()&#039; method is not defined for &#039;Government&#039; object it is available since &#039;Country&#039; object is defined as &#039;Government&#039; prototype.</p>
<h3>Government_France=new Government(&#034;Jacques Chirac&#034;);<br />
Government_France.describeCountry();</h3>
<p>New methods can also be defined for the &#039;Government_France&#039; object:</p>
<h3>Government_France.describeGovernment=function() {<br />
	        alert(&#039;President: &#034;+this.President);<br />
}</h3>
<p>Let’s complete the &#039;Parliament&#039; object definitions.</p>
<h3>Parliament.prototype=new Country(&#034;France&#034;,&#034;Paris&#034;,59330000);<br />
Pn=Parliament.prototype;<br />
Pn.describeParliament=function(){<br />
	alert(&#034;Speaker: &#034;+this.Speaker);<br />
}<br />
Parliament_France=new Parliament(&#034;Jean-Louis Debre&#034;);</h3>
<p>As you can see prototypes can also be modified for the inherited objects.</p>
<p>The above examples demonstrates elegance of the JavaScript OOP model which enables this easy to learn language perform variety of the complex tasks for the real life programming.</p>
<p><strong>Real life example.</strong><br />
This very OOP approach was used in our company when we developed the CodeThat.Com’s set of the web controls. For example the ‘CodeThatCalendar’ is nothing but an object declared as:</p>
<h3>function CodeThatCalendar(def) {<br />
	this.def = def;<br />
	this.links = {};<br />
	this.styles = {};<br />
	this.hideifr = true;<br />
	if (typeof(this.def.img_path)!=&#034;undefined&#034;) {<br />
		    if (this.def.img_path.lastIndexOf(&#034;/&#034;)!=this.def.img_path.length-1) this.def.img_path=this.def.img_path+&#034;/&#034;;<br />
        	  }<br />
   if (typeof(this.def.template_path)!=&#034;undefined&#034;) {<br />
		    if (this.def.template_path.lastIndexOf(&#034;/&#034;)!=this.def.template_path.length-1) this.def.template_path=this.def.template_path+&#034;/&#034;;<br />
            if (this.def.template_path.indexOf(&#034;/&#034;)!=0)<br />
                if (typeof(this.def.img_path)!=&#034;undefined&#034; &#038;&#038; this.def.img_path.indexOf(&#034;/&#034;)!=0) {<br />
                   s=this.def.template_path;<br />
                   a=s.split(&#034;/&#034;);<br />
                   a.length=a.length-1;<br />
                   t=&#034;";<br />
                   for (i=0; i &lt; a.length; i++){<br />
                          t=t+&#034;../&#034;;<br />
                    }<br />
                   this.img_path=t+this.def.img_path;<br />
              }<br />
         }<br />
 };<br />
var CTc = CodeThatCalendar.prototype;<br />
CTc.hide = function()<br />
	{<br />
	&#8230;<br />
	}<br />
CTc.create = function(d,ctl) {<br />
		&#8230;<br />
		}</h3>
<p>Various methods of the control work with the layers giving the control fancy look and feel and enabling user perform various actions the calendar supposed to do. For example, the below function sets the value of the HTML form control to the date user have selected.  This is performed each time user clicks the calendar date.</p>
<h3>function CodeThatSetDay(c,f,d,m,y,i,ifr) {<br />
	var doc;<br />
	var w = window.opener||this.parent;<br />
	if(w&#038;&#038;!i)<br />
		doc = w.document;<br />
	else<br />
		doc = document;<br />
	var e = CodeThatFind(doc,c);<br />
	if(Def(e))<br />
	{<br />
		e.value=CodeThatDateFormat(f,d,m,y);<br />
		if(e.fireEvent) e.fireEvent(&#034;onchange&#034;);<br />
		else {<br />
		 if(e.onchange) e.onchange();<br />
		}<br />
	}<br />
	if(w&#038;&#038;!i)<br />
	{<br />
		if(Def(w) &#038;&#038; Def(ifr))<br />
		{<br />
			var iframe = CodeThatFind(doc,ifr);<br />
			if(Def(iframe))<br />
				iframe.style.visibility = &#039;hidden&#039;;<br />
			if(ua.opera6)<br />
			{<br />
				var d = CodeThatFind(doc,&#034;calendar_div&#034;);<br />
				if(Def(d))<br />
				d.style.visibility=&#039;hidden&#039;;<br />
			}<br />
		}<br />
		else<br />
		{<br />
			window.close();<br />
		}<br />
	}<br />
};</h3>
<p>(The examples of CodeThatCalendar functions are not fully functional. They are listed here for illustrative purposes).<br />
As you can see JavaScript is indeed powerful and user friendly programming language with many abilities which help to create really complex and interesting solutions. Since the DOM model is supported by majority of modern browsers you can be sure your solution will be accessible for the majority of users. Of course there&#039;s much more to learn in the JavaScript: events, DOM, layers, and the cross-browser portability is also not always that transparent but this is for another story or&#8230; several stories.</p>
<p><strong>Author.</strong><br />
About the author: Sergey Zavadski is one of the core JavaScript developers at CodeThat.Com (http://www.codethat.com/) He has developed number of the scripts offered by the company and leads the customers support department.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2004/09/30/oop-in-javascript/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.257 seconds -->
