<?xml version="1.0" encoding="iso-8859-1"?>
<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>CrankBerry Blog &#187; HTML</title>
	<atom:link href="http://www.crankberryblog.com/category/scripts-and-programming/html-programming/feed" rel="self" type="application/rss+xml" />
	<link>http://www.crankberryblog.com</link>
	<description>Sharing ideas on web design, development and the internet economy</description>
	<lastBuildDate>Thu, 24 Nov 2011 19:37:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Why do I get &quot;page includes resources which are not secure&quot;</title>
		<link>http://www.crankberryblog.com/2011/why-do-i-get-page-includes-resources-which-are-not-secure</link>
		<comments>http://www.crankberryblog.com/2011/why-do-i-get-page-includes-resources-which-are-not-secure#comments</comments>
		<pubDate>Thu, 03 Mar 2011 23:51:11 +0000</pubDate>
		<dc:creator>Jerry Low</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Security]]></category>

		<guid isPermaLink="false">http://www.crankberryblog.com/?p=454</guid>
		<description><![CDATA[You just built a site, and have implemented <a href="http://www.crankberryblog.com/2009/what-is-ssl-and-do-i-need-ssl">SSL</a>, but when you go to test it you get "page includes resources which are not secure". This is annoying but you need to fix it.]]></description>
			<content:encoded><![CDATA[<p>You just built a site, and have implemented <a href="http://www.crankberryblog.com/2009/what-is-ssl-and-do-i-need-ssl">SSL</a>, but when you go to test it you get &#034;page includes resources which are not secure&#034;. This is annoying but you need to fix it.</p>
<p>You can choose to ignore it as for most browser this message is not obtrusive but for some this may generate constant popups that will bug the hell out of your users.</p>
<p>There is only one reason why this message shows up but maybe multiple elements that contributes to this. The reason why this message appears is that on the page you&#039;re trying to load through SSL you have links to elements that are not secured through the layer. The warning is letting the user know that although the page maybe secure some elements could put the user at risk. It is essential to have this message. Image you&#039;re on a payment website about to type in your credit card and &#034;BAM&#034; this message pops up. What if it is the credit card module that is not secure? Wouldn&#039;t you worry? Let&#039;s see some of the elements that causes this.</p>
<h3>Your Own Content</h3>
<p>Depending on the way you apply SSL to your user there maybe a leakage in the elements that are secure. You can use HTACCESS to force SSL on a folder by placing this in .htaccess within that folder:</p>
<div class="dean_ch" style="white-space: wrap;"># Turn On for This Folder<br />
RewriteCond %{SERVER_PORT} 80 <br />
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]</div>
<p>This is assuming you have the rewrite engine and everything enabled. If you have a single file within the directory put into SSL this might be trickier. Look at the page and the elements it links to. Although the page maybe forced into SSL the images, scripts and CSS may not be (don&#039;t worry about included PHP scripts they don&#039;t count for this). The method that could work is to force those directory into SSL as well. Now this code is not perfect but it has worked:</p>
<div class="dean_ch" style="white-space: wrap;">RewriteCond %{SERVER_PORT} ^443$<br />
RewriteCond %{REQUEST_URI} ^/(image|css|javascripts)/?<br />
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1/$2 [R,L]</div>
<p>Basically image, css and javascripts are locations (folders) where those files are located. Change these based on your files. Add more directories with | in between each name.</p>
<h3>Analytics</h3>
<p>If you use a third party analytics tracker you may have pasted some sort of code at the bottom of your page. Depending on who you use they may not support SSL. If that&#039;s the case you can code it into your file to exclude the script from running. Here&#039;s a PHP example:</p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw2">&lt;?php</span> <span class="kw1">if</span> <span class="br0">&#40;</span>!<a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st0">&#039;HTTPS&#039;</span><span class="br0">&#93;</span><span class="br0">&#41;</span> || <span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st0">&#039;HTTPS&#039;</span><span class="br0">&#93;</span> != <span class="st0">&quot;on&quot;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span> <span class="kw2">?&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//Analytics Script</span><br />
<span class="kw2">&lt;?php</span> <span class="br0">&#125;</span> <span class="kw2">?&gt;</span></div>
<h3>Advertisement and Third Party Codes</h3>
<p>Just like the analytics code above, third party codes may not have an SSL option for you. If you use a third party code on your site such as advertisements, widgets and feeds you may have to turn it off with the same code as above:</p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw2">&lt;?php</span> <span class="kw1">if</span> <span class="br0">&#40;</span>!<a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st0">&#039;HTTPS&#039;</span><span class="br0">&#93;</span><span class="br0">&#41;</span> || <span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st0">&#039;HTTPS&#039;</span><span class="br0">&#93;</span> != <span class="st0">&quot;on&quot;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span> <span class="kw2">?&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//Ads, Widgets and Feeds</span><br />
<span class="kw2">&lt;?php</span> <span class="br0">&#125;</span> <span class="kw2">?&gt;</span></div>
<p>The downside is that on these pages you can&#039;t use the third party codes. Depending on the page, you may not want to anyways. For example, if you were using analytics on a checkout page, you may just want to check your database for actual analytics rather than hits and bounce rates.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crankberryblog.com/2011/why-do-i-get-page-includes-resources-which-are-not-secure/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>The ultimate newb&#039;s guide to learning web development (Pt. 1: The Basic)</title>
		<link>http://www.crankberryblog.com/2010/the-ultimate-newbs-guide-to-learning-web-development-pt-1-the-basic</link>
		<comments>http://www.crankberryblog.com/2010/the-ultimate-newbs-guide-to-learning-web-development-pt-1-the-basic#comments</comments>
		<pubDate>Fri, 24 Sep 2010 22:22:21 +0000</pubDate>
		<dc:creator>Jerry Low</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.crankberryblog.com/?p=406</guid>
		<description><![CDATA[If you are just discovering the world of web development but know nothing about HTML code, css and mumble-jumble, here's a good place to start. In this article I will outline in general where to find resources and some good skills to pick up on to becoming a minor expert in the field.]]></description>
			<content:encoded><![CDATA[<p>If you are just discovering the world of web development but know nothing about HTML code, css and mumble-jumble, here&#039;s a good place to start. In this article I will outline in general where to find resources and some good skills to pick up on to becoming a minor expert in the field.</p>
<p>To be honest, web development is all about practice and understanding, of course creativity as well (I&#039;ll get to this later). Here&#039;s a little scope about how I picked up on web development. I started making websites through FrontPage when I was 13, using only a bit of HTML and mainly the WYSIWYG (what you see is what you get) editor. It wasn&#039;t until I was 15 that I started developing with HTML and using CSS. When I was 18 I felt the need for more power in my websites which is when I picked up PHP and MySQL. About a year ago was finally when I started picking up on Javascript.</p>
<p>Basically, I learned everything through every resource except taking classes. I would search through the web, read books from the library or just pure trial and error. It wasn&#039;t insanely hard to gather all the information but the only times when I really learn was through projects and experiments. Web development is definitely a hands-on type of thing. Point is, if you want to learn web development you&#039;ll have to spend 30% reading and 70% doing.</p>
<h2>The Program/Software</h2>
<p>Web development can be accomplished through a few languages and most of them don&#039;t require any special software to write. The basic notepad that came with your Windows is capable of completing the task. I prefer to use a software that color codes coding to mitigate headaches. Here&#039;s a list of software that you could choose from.</p>
<ul>
<li><a href="http://notepad-plus-plus.org/" target="_blank">Notepad++ (Free)</a></li>
<li><a href="http://kompozer.net/" target="_blank">KompoZer (Free)</a></li>
<li><a href="http://www.w3.org/Amaya/" target="_blank">Amaya (Free)</a></li>
<li><a href="http://www.seamonkey-project.org/" target="_blank">SeaMonkey (Free)</a></li>
<li><a href="http://www.microsoft.com/expression/" target="_blank">Microsoft Expression Studio ($149)</a></li>
<li><a href="http://www.adobe.com/products/dreamweaver/" target="_blank">Adobe Dreamweaver ($399)</a></li>
</ul>
<p>I personally use Dreamweaver on my computer as I have been using it since I was young so I have a nostalgic feeling to it. When I&#039;m on the go I have notepad++ on my USB.</p>
<h2>Learning HTML</h2>
<p>Before you learn anything else, you have to be really good at HTML (hyper text markup language). The basic of websites all boils down to this language. HTML is the markup language containing markup tags that creates the webpage document. Every website requires HTML to make it work, yes even Flash websites.</p>
<p>Your basic website is wrapped in an opening and closing HTML tag. Opening tags are surrounded by arrow brackets while closing tags are the same but there&#039;s a front slash immediately after the first arrow bracket like such</p>
<div class="dean_ch" style="white-space: wrap;">&lt;html&gt;&lt;/html&gt;</div>
<p>Within the HTML tags there will be a HEAD and BODY tag. The head tags will describe items related to the website but will not be produced in the content. Items such as site title, meta tags, CSS, and Javascripts can be defined in the HEAD tag. The BODY tag will describe content that will be outputted to the user. A code like this:</p>
<div class="dean_ch" style="white-space: wrap;">&lt;html&gt;<br />
&lt;head&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;title&gt;Test Page&lt;/title&gt;<br />
&lt;/head&gt;</p>
<p>&lt;body&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Hello world!<br />
&lt;/body&gt;<br />
&lt;/html&gt;</div>
<p>Will output &#034;Hello world!&#034; on the browser with the title Test Page in the browser title bar. Once you get this down you&#039;re ready to start building the website. The goal following this is to output the content you wish to show, it could be paragraphed text, images or tables. Everything you wished to use requires a markup tag to make it work. It&#039;ll be redundant for me to give you a tutorial on all the tags but here are two resources that are great.</p>
<ul>
<li><a href="http://www.w3schools.com/html/default.asp" target="_blank">w3school &#8211; HTML</a></li>
<li><a href="http://www.html.net/tutorials/html/" target="_blank">HTML.net</a></li>
</ul>
<p>w3school is great, as they are short writeups but concise so you can digest all of the content quickly. HTML.net is more detailed and a great read too but they incorporate a bit of CSS so its better to read it after w3school to cross-reference some of the ideas and undestanding. Once you&#039;ve got this down you&#039;re ready for some CSS.</p>
<h2>Learning CSS</h2>
<p>CSS (Cascading Style Sheet) is a language that focuses on the style and layout of your markup language. Its a common standard now generate the accurate aesthetic results of many websites. There are a few ways to include CSS in your website.</p>
<div class="dean_ch" style="white-space: wrap;">//Link to a CSS file &#8211; Goes in the &lt;head&gt;&lt;/head&gt; tag<br />
&lt;link href=&quot;css/styles.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;</p>
<p>//Have the CSS in the &lt;head&gt;&lt;/head&gt; tag<br />
&lt;style type=&quot;text/css&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; .css { font-weight: bold; }<br />
&lt;/style&gt;</p>
<p>//Inline with content markup tags &#8211; in &lt;body&gt;&lt;/body&gt; tag<br />
&lt;p style=&quot;font-size: 22px;&quot;&gt;this is a paragraph&lt;/p&gt;<br />
&nbsp;</div>
<p>Once you have your website linked with some CSS you can start controlling your website. Here are some example of CSS controlling a webpage.</p>
<div class="dean_ch" style="white-space: wrap;">//All paragraph content will be bold and have a line height of 22 pixels<br />
p { font-weight: bold; line-height: 22px; }</p>
<p>//The following code will modify all markup tags with the class &quot;change&quot; to have a background color of black<br />
.change { background: #000; }</p>
<p>//The following code will modify the element with ID &quot;element_1&quot; to have a background color of white<br />
#element_1 { background: #FFF; }</div>
<p>Here are the resources to read to learn all about CSS.</p>
<ul>
<li><a href="http://www.w3schools.com/css/default.asp" target="_blank">w3school &#8211; CSS</a></li>
<li><a href="http://www.html.net/tutorials/css/" target="_blank">HTML.net</a></li>
</ul>
<p>Again its good to go over the basics with w3school first then head to HTML.net. </p>
<p>At this point you should practice making a few websites with HTML and CSS. Try to envision something and then build it. The best practice is to try to design something in Photoshop then try to build a web site from it. As I always tell developers, just design it and I&#039;ll make it into a template, because I don&#039;t believe there&#039;s many design limitations that can&#039;t be built with HTML and CSS. By doing this exercise it&#039;ll help you learn different methods of building different elements.</p>
<h2>Notes and Reminders</h2>
<p>There are some things you should keep in mind when building with HTML and CSS though.</p>
<h3>Using tables for design</h3>
<p>This is a no and not recommended. A lot of people argue over this topic. Some believe that tables are good for design because its easier to control and it holds the shape of the original design better. The problem is tables are clunky, heavy in coding and not very flexible. Tables have specific standards to them so if you have two rows and two columns, the columns have to be equal width while rows have to be equal height. In order to work around that you&#039;ll have to nest your tables, imagine dealing with that. Its also less flexible for future expansions. You should use a table for tabular data though. Extreme non-table believers will argue that you don&#039;t, they can produce the same effect with other elements. They sure can but when it comes down to the user extracting your data (copying to word or excel), copying for a table is much easier than anything else. It just makes sense.</p>
<h3>Avoid absolute positioning of everything</h3>
<p>Many developers when they start will notice the amount of control with absolute positioning. It is not until their design gets more complicated that it all falls apart. Absolute position provides more flexibility but will sometimes diminish your control, use wisely.</p>
<h3>Test in multiple browsers</h3>
<p>There are various browsers on the web. It sometimes depends on who your website caters to but mind as well cover the major users. Test on desktop machines with Internet Explorer 6, 7, 8, 9, Chrome, Firefox, Safari. On mobile devices with Android, Opera Mini, iOS. Just make sure everything&#039;s consistent. This is a good chance to test how good your skills are too.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crankberryblog.com/2010/the-ultimate-newbs-guide-to-learning-web-development-pt-1-the-basic/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>In page popup with faded background &#8211; in PHP</title>
		<link>http://www.crankberryblog.com/2009/in-page-popup-with-faded-background-in-php</link>
		<comments>http://www.crankberryblog.com/2009/in-page-popup-with-faded-background-in-php#comments</comments>
		<pubDate>Tue, 20 Oct 2009 23:12:52 +0000</pubDate>
		<dc:creator>Jerry Low</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.crankberryblog.com/?p=232</guid>
		<description><![CDATA[Sometimes you may be required to have popup windows on your website. They're obtrusive and hard to style with your site, in summary - nasty. What I've seen is other websites fade out their background and have an in page popup. I came up with a script that does the same thing in PHP and it looks exactly like the image below. Jump to the next page for the script.]]></description>
			<content:encoded><![CDATA[<p>Sometimes you may be required to have popup windows on your website. They&#039;re obtrusive and hard to style with your site, in summary &#8211; nasty. What I&#039;ve seen is other websites fade out their background and have an in page popup. I came up with a script that does the same thing in PHP.</p>
<p>Now the code involves multiple parts so bare with me here. Either way your end product will look like the image below.</p>
<p><img src="http://www.crankberryblog.com/images/in-page-pop-up.jpg" /></p>
<p>Lets start with the CSS here. Just copy and paste this into your CSS file or HTML.</p>
<div class="dean_ch" style="white-space: wrap;">&lt;style type=&quot;text/css&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; html {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; height: 100%; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; .fade_container {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; width: 100%;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; height: 100%;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; min-height: 100%;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; position: absolute;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; top: 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; left: 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; z-index: 100000;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; overflow: hidden;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; .fade {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; width: 100%;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; height: 100%;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; min-height: 100%;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; background: #000;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; position: absolute;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; top: 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; left: 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; z-index: 110000;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; overflow: hidden;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; .popup {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; font-family: Arial, Helvetica, sans-serif;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; font-size: 10px;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; padding: 4px;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; position: absolute;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; left: 50%;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; top: 100px;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; z-index: 150000;&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; .popup_close {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; font-family: Arial, Helvetica, sans-serif;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; font-size: 9px;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; padding: 2px;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; margin-bottom: 5px;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; background: #CCC;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text-align: right;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; .popup_close a:link, .popup_close a:visited, .popup_close a:hover, .popup_close a:active {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; color: #333;&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text-decoration: none;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&lt;/style&gt;</div>
<p>There&#039;s really no need to edit anything unless you want to change the font and stuff, the colors will be modified later. The next part you have to add this code <strong>right after</strong> your &lt;body&gt; tag.</p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw2">&lt;?php</span></p>
<p><span class="co1">//In Page Popup Box with Faded Background by Jerry Low @crankberryblog.com</span><br />
<span class="co1">//Find other useful scripts at the Crankberry Blog</span></p>
<p><span class="co1">//SETTINGS</span><br />
<span class="re0">$fade_amount</span> = <span class="nu0">60</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//In Percentage</span><br />
<span class="re0">$box_width</span> = <span class="nu0">400</span>;<br />
<span class="re0">$box_background</span> = <span class="st0">&#039;FFFFFF&#039;</span>;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//Hex Color</span><br />
<span class="re0">$box_border_width</span> = <span class="nu0">1</span>;<br />
<span class="re0">$box_border_color</span> = <span class="st0">&#039;999999&#039;</span>;&nbsp; &nbsp;<span class="co1">//Hex Color</span><br />
<span class="re0">$close_box</span> = <span class="nu0">1</span>;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//Do You Want The Close Bar on Top 1 = Yes, 0 = No</span><br />
<span class="re0">$extension</span> = <span class="st0">&quot;&quot;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Other Variables that maybe needed, page number etc.</span></p>
<p>
<span class="co1">//Begin Popup Box</span><br />
<span class="re0">$left_margin</span> = <span class="nu0">0</span> &#8211; <span class="br0">&#40;</span><span class="re0">$box_width</span>/<span class="nu0">2</span><span class="br0">&#41;</span>;<br />
<span class="re0">$page_url</span> = <a href="http://www.php.net/basename"><span class="kw3">basename</span></a><span class="br0">&#40;</span><span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st0">&#039;PHP_SELF&#039;</span><span class="br0">&#93;</span><span class="br0">&#41;</span>;<br />
<span class="kw1">if</span> <span class="br0">&#40;</span><span class="re0">$extension</span>!=<span class="st0">&quot;&quot;</span><span class="br0">&#41;</span> <span class="re0">$page_url</span> .= <span class="st0">&#039;?&#039;</span> . <span class="re0">$extension</span>;</p>
<p><span class="kw1">if</span> <span class="br0">&#40;</span><a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$_GET</span><span class="br0">&#91;</span><span class="st0">&#039;popup&#039;</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&#039;&lt;div class=&quot;popup&quot; style=&quot;width:&#039;</span>.<span class="re0">$box_width</span>.<span class="st0">&#039;px; background: #&#039;</span>.<span class="re0">$box_background</span>.<span class="st0">&#039;; &nbsp;margin-left:&#039;</span>.<span class="re0">$left_margin</span>.<span class="st0">&#039;px;&#039;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="re0">$box_border_width</span>&gt;<span class="nu0">1</span><span class="br0">&#41;</span> <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&#039; border: &#039;</span>.<span class="re0">$box_border_width</span>.<span class="st0">&#039;px solid #&#039;</span>.<span class="re0">$box_border_color</span>.<span class="st0">&#039;;&#039;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&#039;&quot;&gt;&#039;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//Close Box</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="re0">$close_box</span>===<span class="nu0">1</span><span class="br0">&#41;</span> <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&#039;&lt;div class=&quot;popup_close&quot;&gt;&lt;a href=&quot;&#039;</span>.<span class="re0">$page_url</span>.<span class="st0">&#039;&quot;&gt;Close (x)&lt;/a&gt;&lt;/div&gt;&#039;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">?&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;!&#8211; START YOUR POPUP CONTENT HERE &#8211;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="me1">Popup</span> content goes in here!<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;!&#8211; <a href="http://www.php.net/end"><span class="kw3">END</span></a> OF YOUR POPUP CONTENT HERE &#8211;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">&lt;?php</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&#039;&lt;/div&gt;<br />
&nbsp; &nbsp; &lt;div class=&quot;fade&quot; onclick=&quot;location.replace(<span class="es0">\&#039;</span>&#039;</span>.<span class="re0">$page_url</span>.<span class="st0">&#039;<span class="es0">\&#039;</span>);&quot; style=&quot;opacity: 0.&#039;</span>.<span class="re0">$fade_amount</span>.<span class="st0">&#039;; &nbsp;-moz-opacity: 0.&#039;</span>.<span class="re0">$fade_amount</span>.<span class="st0">&#039;;filter: alpha(opacity: &#039;</span>.<span class="re0">$fade_amount</span>.<span class="st0">&#039;);&quot;&gt;&lt;/div&gt;<br />
&nbsp; &nbsp; &lt;div class=&quot;fade_container&quot;&gt;&#039;</span>;</p>
<p><span class="br0">&#125;</span></p>
<p><span class="kw2">?&gt;</span></div>
<p>Looking at the top part of what you just added, the setting are at the top. Just configure it to what ever you like. </p>
<p>The Content</p>
<p>The content of your popup box goes in between the HTML comment tag in the code above. Exactly where I wrote: Popup content goes in here!</p>
<div class="dean_ch" style="white-space: wrap;">&lt;!&#8211; START YOUR POPUP CONTENT HERE &#8211;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
Popup content goes in here!<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&lt;!&#8211; END OF YOUR POPUP CONTENT HERE &#8211;&gt;<br />
&nbsp;</div>
<p>Next you need the trigger to activate the popup. Something like this:</p>
<div class="dean_ch" style="white-space: wrap;">&lt;a href=<span class="st0">&quot;?popup=1&lt;?php if ($extension!=&#034;) echo &#039;&amp;&#039; . $extension; ?&gt;&quot;</span>&gt;Activated Box&lt;/a&gt;</div>
<p>To finish off the code you will need to add a &lt;/div&gt; tag just before the &lt;/body&gt; closing tag. Like so:</p>
<div class="dean_ch" style="white-space: wrap;">&lt;/div&gt;&lt;/body&gt;</div>
<p>That&#039;s it and all you need to have your own in page with faded background popup window. Wasn&#039;t that just simple?</p>
<p><strong>Advance Configuration</strong></p>
<p>Now if your pages require other variables to be passed through the URL I noticed that the popup will intrude on that. So I have an extension variable where you can attach other variables to and they will be kept. The variable is in the setting part of the code. Example of attaching some variables.</p>
<div class="dean_ch" style="white-space: wrap;"><span class="re0">$extension</span> = <span class="st0">&quot;&quot;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Other Variables that maybe needed, page number etc.</span><br />
<span class="re0">$extension</span> = <span class="st0">&#039;p=3&amp;sort=2&amp;id=214423&#039;</span>;<br />
&nbsp;</div>
]]></content:encoded>
			<wfw:commentRss>http://www.crankberryblog.com/2009/in-page-popup-with-faded-background-in-php/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

