<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>webJestic.NET</title>
	
	<link>http://webjestic.net</link>
	<description>Making Internet Business Simple</description>
	<lastBuildDate>Wed, 10 Jun 2009 17:20:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/webjestic" type="application/rss+xml" /><feedburner:emailServiceId>webjestic</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>Database Designs: MySQL NULL Fields</title>
		<link>http://feedproxy.google.com/~r/webjestic/~3/MF4eMVo4_gs/</link>
		<comments>http://webjestic.net/440/database-designs-mysql-null-fields/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 13:28:55 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[MySQL Developer]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://webjestic.net/?p=440</guid>
		<description><![CDATA[Does your table designs support NULL values?
There is a debate about creating tables which permit NULL values.  I personally make every effort to make every field in a table NOT NULL.  The argument for this:  I want to be able to depend on my SQL statements.  In this post I will [...]]]></description>
			<content:encoded><![CDATA[<p>Does your table designs support NULL values?</p>
<p>There is a debate about creating tables which permit NULL values.  I personally make every effort to make every field in a table NOT NULL.  The argument for this:  <em>I want to be able to depend on my SQL statements.</em>  In this post I will illustrate how an insignificant field that allows NULL values can create an issue.  This is a simple illustration.  More complex queries can break down as easily where NULL values are allowed.</p>
<p>It&#8217;s in my opinion, that NULL fields should be a topic for discussion, when you begin talking about your designs and the integrity behind those designs.</p>
<p><strong>Example:</strong> NULL fields are allowed.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">CREATE</span> <span class="kw1">TABLE</span> SECURITY_USERS <span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;SECURITY_USER_ID Integer <span class="kw1">NOT</span> <span class="kw1">NULL</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;USER_NAME Varchar<span class="br0">&#40;</span><span class="nu0">30</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;FIRST_NAME Varchar<span class="br0">&#40;</span><span class="nu0">20</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp;LAST_NAME Varchar<span class="br0">&#40;</span><span class="nu0">20</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;MIDDLE_INITIAL Varchar<span class="br0">&#40;</span><span class="nu0">1</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;CONSTRAINT PK_SECURITY_USERS <span class="kw1">PRIMARY</span> <span class="kw1">KEY</span> <span class="br0">&#40;</span>SECURITY_USER_ID<span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;CONSTRAINT UNQ_SECURITY_USERS_USER_NAME <span class="kw1">UNIQUE</span> <span class="br0">&#40;</span>USER_NAME<span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#41;</span> TYPE=InnoDB <span class="kw1">DEFAULT</span> CHARSET=utf8;</div>
</li>
</ol>
</div>
<p>There are several things wrong with this table, but for the moment I would like to simply use it as an example of a table that supports NULL values.  There are plenty of other fields in this table, but I&#8217;ve removed them for the sake of this post. They all permit NULL values.</p>
<p>In my opinion, the problem with this style design is that &#8220;<em>I can&#8217;t always depend on my queries to produce good results</em>&#8220;.  Most of the time the system has entered in FIRST_NAME and LAST_NAME into the table and sometimes but not always, they entered a MIDDLE_INITIAL.</p>
<p>So, if we have two users in the system and the data looks like this:</p>
<p><strong>Example:</strong> Sample data.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="coMULTI">/*</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">SECURITY_USER_ID &nbsp;| &nbsp;USER_NAME &nbsp;| &nbsp;LAST_NAME &nbsp;| &nbsp;FIRST_NAME &nbsp;| &nbsp;MIDDLE_INITIAL</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;admin &nbsp; &nbsp; &nbsp; &nbsp; Master &nbsp; &nbsp; &nbsp; &nbsp;Web &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(NULL)</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;jdoe &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Doe &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; John &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;B</span></div>
</li>
<li class="li2">
<div class="de2"><span class="coMULTI">*/</span></div>
</li>
</ol>
</div>
<p>&#8230;and one of them has a middle initial, while the other does not.  Then this creates the potential for unpredictable results in advanced queries.  </p>
<p><strong>Example:</strong> SQL Statement.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">SELECT</span> concat<span class="br0">&#40;</span>LAST_NAME, <span class="st0">&#8216;, &#8216;</span>, FIRST_NAME, <span class="st0">&#8216; &#8216;</span>, MIDDLE_INITIAL<span class="br0">&#41;</span> <span class="kw1">AS</span> FULL_NAME</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">FROM</span> security_users <span class="kw1">WHERE</span> security_user_id = <span class="nu0">1</span> <span class="kw1">OR</span> security_user_id = <span class="nu0">2</span></div>
</li>
</ol>
</div>
<p>All I want to do is concatenate the users name in SQL, so it displays in the format of my choice without my having to do it in code.  Sometimes, it&#8217;s nice to bring back data in the format you want.  Besides, if I execute this query in more than one place in my application I don&#8217;t want to have to continue formatting it in code.  I just like to have the query do it.</p>
<p>The problem is, when NULL fields are allowed, you cannot depend on good results.  Especially if I built my query and was testing it with people who had middle names.  The first time the query came across someone who had a NULL middle name in the application, the application would receive unexpected results.</p>
<p><strong>Example:</strong> Query Results</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="coMULTI">/*</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">FULL_NAME</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">(NULL)</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">Doe, John B</span></div>
</li>
<li class="li2">
<div class="de2"><span class="coMULTI">*/</span></div>
</li>
</ol>
</div>
<p>Despite the fact there is data in FIRST_NAME (= Web) and LAST_NAME (= Master), the returned result is still NULL.  The MySQL <strong>concat()</strong> function failed to return the proper results, because MIDDLE_INITIAL contains a NULL value.  </p>
<p>Using simple straight forward SQL statements failed, due to a NULL field in MIDDLE_INITIAL.  This is a visual example; something we can see in a result window.  However, if I had a more complicated query and was using a NULL field in a JOIN, then the problem isn&#8217;t as interesting.  The problem can even become frustrating.</p>
<p><strong>Example:</strong> NOT NULL table redesign (following the data structure)</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">CREATE</span> <span class="kw1">TABLE</span> security_users <span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp;id bigint<span class="br0">&#40;</span><span class="nu0">20</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span> <span class="kw1">AUTO_INCREMENT</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp;user_name varchar<span class="br0">&#40;</span><span class="nu0">30</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp;user_first_name varchar<span class="br0">&#40;</span><span class="nu0">20</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span>,</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp;user_last_name varchar<span class="br0">&#40;</span><span class="nu0">20</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp;user_middle_initial varchar<span class="br0">&#40;</span><span class="nu0">1</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span> <span class="kw1">DEFAULT</span> <span class="st0">&#8221;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp;<span class="kw1">UNIQUE</span> <span class="kw1">KEY</span> user_name <span class="br0">&#40;</span>user_name<span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp;<span class="kw1">PRIMARY</span> <span class="kw1">KEY</span> <span class="br0">&#40;</span>id<span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#41;</span> TYPE=InnoDB <span class="kw1">DEFAULT</span> CHARSET=UTF8 <span class="kw1">AUTO_INCREMENT</span>=<span class="nu0">1000</span>;</div>
</li>
</ol>
</div>
<p>In this table, MIDDLE_INITIAL has a value, even if the value is empty.  An empty value is not the same as NULL and the results would return as I might expect them.  The query in this post would execute properly and return the right results.</p>
<img src="http://feeds.feedburner.com/~r/webjestic/~4/MF4eMVo4_gs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://webjestic.net/440/database-designs-mysql-null-fields/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://webjestic.net/440/database-designs-mysql-null-fields/</feedburner:origLink></item>
		<item>
		<title>Working with MySQL Auto Incrementing Keys</title>
		<link>http://feedproxy.google.com/~r/webjestic/~3/qGqdeYLvEx8/</link>
		<comments>http://webjestic.net/423/working-with-mysql-auto-incrementing-keys/#comments</comments>
		<pubDate>Sun, 10 May 2009 08:31:56 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[MySQL Developer]]></category>
		<category><![CDATA[PHP Developer]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://webjestic.net/?p=423</guid>
		<description><![CDATA[If you&#8217;ve been working with Firebird, Oracle, or any number of other databases, the first thing you&#8217;ll want to understand is how to work with MySQL auto_increment keys.  Anytime you work with keys that are auto incremented by the database engine, you will need a way to retrieve the key values for your insert [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve been working with <a href="http://firebirdsql.com/">Firebird</a>, Oracle, or any number of other databases, the first thing you&#8217;ll want to understand is how to work with MySQL <em>auto_increment</em> keys.  Anytime you work with keys that are auto incremented by the database engine, you will need a way to retrieve the key values for your insert statements.  Relational database are built on joins and understanding how to assign your foreign keys is essential.</p>
<p>Using MySQL to manage your foreign key inserts you can use the <em>LAST_INSERT_ID</em>() function.  This allows you to directly insert the value for your foreign keys without having to execute a query or some other mechanism.  The LAST_INSERT_ID() MySQL function returns the value of the PRIMARY KEY previously inserted.</p>
<p>This works perfectly for simple designs where only a single foreign key exists and you want to link to the master table.</p>
<p><strong>Example: Tables used</strong></p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">CREATE</span> <span class="kw1">TABLE</span> web_template <span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; id bigint<span class="br0">&#40;</span><span class="nu0">20</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span> <span class="kw1">AUTO_INCREMENT</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; template_name varchar<span class="br0">&#40;</span><span class="nu0">30</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; template_location varchar<span class="br0">&#40;</span><span class="nu0">100</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span>,</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">UNIQUE</span> <span class="kw1">KEY</span> template_name <span class="br0">&#40;</span>template_name<span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">PRIMARY</span> <span class="kw1">KEY</span> <span class="br0">&#40;</span>id<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#41;</span> TYPE=InnoDB <span class="kw1">DEFAULT</span> CHARSET=UTF8 <span class="kw1">AUTO_INCREMENT</span>=<span class="nu0">1000</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">CREATE</span> <span class="kw1">TABLE</span> web_config <span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; id bigint<span class="br0">&#40;</span><span class="nu0">20</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span> <span class="kw1">AUTO_INCREMENT</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; config_template_id bigint<span class="br0">&#40;</span><span class="nu0">20</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; <span class="kw1">PRIMARY</span> <span class="kw1">KEY</span> <span class="br0">&#40;</span>id<span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">FOREIGN</span> <span class="kw1">KEY</span> <span class="br0">&#40;</span>config_template_id<span class="br0">&#41;</span> <span class="kw1">REFERENCES</span> web_template<span class="br0">&#40;</span>id<span class="br0">&#41;</span> <span class="kw1">ON</span> <span class="kw1">DELETE</span> CASCADE</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#41;</span> TYPE=InnoDB <span class="kw1">DEFAULT</span> CHARSET=UTF8 <span class="kw1">AUTO_INCREMENT</span>=<span class="nu0">1000</span>;</div>
</li>
</ol>
</div>
<p><br/><br />
<strong>Example: Insert statements</strong></p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">INSERT</span> <span class="kw1">INTO</span> web_template <span class="br0">&#40;</span>template_name, template_location<span class="br0">&#41;</span> <span class="kw1">VALUES</span> <span class="br0">&#40;</span><span class="st0">&#8216;Default Template&#8217;</span>, <span class="st0">&#8216;/template/Default/&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">INSERT</span> <span class="kw1">INTO</span> web_config <span class="br0">&#40;</span>config_template_id<span class="br0">&#41;</span> <span class="kw1">VALUES</span> <span class="br0">&#40;</span>LAST_INSERT_ID<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p><br/><br />
In PHP we have the <em>mysql_insert_id()</em> function, which allows us to retrieve the last key inserted.  This function works pretty good, but it must be executed before you commit your transaction, otherwise you might get unexpected results. Additionally, it&#8217;s ideal to execute the statement directly after you submit your insert statement.</p>
<p>Using this function gives us more flexibility in key management in our applications, especially when working with tables that have multiple foreign keys.</p>
<p><strong>Example: PHP statements</strong></p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">&lt;?php</span></div>
</li>
<li class="li1">
<div class="de1"><a href="http://www.php.net/mysql_query"><span class="kw3">mysql_query</span></a><span class="br0">&#40;</span><span class="st0">&quot;insert into web_template (template_name, template_location) values (&#8217;Default Template&#8217;, &#8216;/template/Default/&#8217;&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$web_template_id</span> = <a href="http://www.php.net/mysql_insert_id"><span class="kw3">mysql_insert_id</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><a href="http://www.php.net/mysql_query"><span class="kw3">mysql_query</span></a><span class="br0">&#40;</span><span class="st0">&quot;insert into web_config (config_template_id) values (&quot;</span>.<span class="re0">$web_template_id</span>.<span class="st0">&quot;)&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="kw2">?&gt;</span></div>
</li>
</ol>
</div>
<p><br/><br />
<strong>Note:</strong> In a &#8220;<em>data aware controls</em>&#8221; environment, it&#8217;s not always easy to manage your auto incrementing keys (a lot of this is due to design, not just environment).  In most cases where I have the decision making power I try to avoid data aware control development (especially on the web, now that <a href="http://webjestic.net/category/delphi-for-php/">Delphi for PHP</a> is available).  Read only grids are an exception, but most of the time you can design your applications to avoid &#8220;live data aware&#8221; entry/edit forms.  It may seem like more work, but I believe in the end it&#8217;s cleaner and easier to debug.</p>
<img src="http://feeds.feedburner.com/~r/webjestic/~4/qGqdeYLvEx8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://webjestic.net/423/working-with-mysql-auto-incrementing-keys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://webjestic.net/423/working-with-mysql-auto-incrementing-keys/</feedburner:origLink></item>
		<item>
		<title>How to Convert a Fireworks Image Design to HTML</title>
		<link>http://feedproxy.google.com/~r/webjestic/~3/O-FyO0ly2w0/</link>
		<comments>http://webjestic.net/416/how-to-convert-a-fireworks-image-design-to-html/#comments</comments>
		<pubDate>Fri, 08 May 2009 12:54:40 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Web Designer]]></category>
		<category><![CDATA[Fireworks]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://webjestic.net/?p=416</guid>
		<description><![CDATA[(Please open the article to see the flash file or player.)
In the last video in this mini site creation series I showed How to Design a Mini Site in Fireworks.  In this video I show how to slice the image and export the image into HTML and then modify it into a very basic [...]]]></description>
			<content:encoded><![CDATA[<div style="margin:10px; float:left"><small>(Please open the article to see the flash file or player.)</small></div>
<p>In the last video in this mini site creation series I showed <a href="http://webjestic.net/405/how-to-design-a-mini-site-in-fireworks/">How to Design a Mini Site in Fireworks</a>.  In this video I show how to slice the image and export the image into HTML and then modify it into a very basic mini site.</p>
<p>There is nothing advanced in this tutorial, it&#8217;s just a very basic slice and export process with very minimal editing.  This is to assist someone who has very little knowledge and experience with HTML.  Basic understanding of using word processors and editing documents is all that&#8217;s required. </p>
<p>Please visit <a href="http://w3schools.com">W3Schools</a> to learn basic HTML programming.</p>
<p>I&#8217;ve created the two menu pages seen in the design image and created a link to the exported HTML mini site.  <a href="http://webjestic.net/video/SES-MiniSite/">You can view it here</a>.  I haven&#8217;t added anything to it that isn&#8217;t in the video.  It is exactly how it was when I designed it in the video.</p>
<img src="http://feeds.feedburner.com/~r/webjestic/~4/O-FyO0ly2w0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://webjestic.net/416/how-to-convert-a-fireworks-image-design-to-html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://webjestic.net/416/how-to-convert-a-fireworks-image-design-to-html/</feedburner:origLink></item>
		<item>
		<title>How to Design a Mini Site in Fireworks</title>
		<link>http://feedproxy.google.com/~r/webjestic/~3/-0KTZshfFS4/</link>
		<comments>http://webjestic.net/405/how-to-design-a-mini-site-in-fireworks/#comments</comments>
		<pubDate>Fri, 08 May 2009 09:50:48 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Web Designer]]></category>
		<category><![CDATA[Fireworks]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://webjestic.net/?p=405</guid>
		<description><![CDATA[(Please open the article to see the flash file or player.)
In the last video series, I went through the process of How to Create eCovers (eBooks) and in this video I show how to design the mini site that compliments that eCover.
Mini sites are a pretty easy way to quickly create a website that is [...]]]></description>
			<content:encoded><![CDATA[<div style="margin:10px; float:left"><small>(Please open the article to see the flash file or player.)</small></div>
<p>In the last video series, I went through the process of <a href="http://webjestic.net/396/how-to-create-ecovers-fwpsebooks/">How to Create eCovers (eBooks)</a> and in this video I show how to design the mini site that compliments that eCover.</p>
<p>Mini sites are a pretty easy way to quickly create a website that is e-commerce ready.  You can find tons of them on the internet in almost every genre imaginable.  More commonly, the mini site serves the purpose of selling informational products, such as &#8220;<em>How-to Make Money Online</em>&#8220;.  A somewhat horrible industry, due to the fact there is a lot stupid information available. I think most of that information is recycled garbage, modified by someone who promises riches, but has no idea what they are doing.</p>
<p>Nevertheless, the mini site is a powerful web site formula and not to be overlooked by someone with real talent and real knowledge.  Understanding the formula and how to design and create the mini site is a valuable asset, as it can be used in many ways by both the entrepreneur and the freelancer.</p>
<p>The image below is the end result of this design video.<center><img src="http://webjestic.net/wp-content/uploads/2009/05/minisitesample01.jpg" alt="minisitesample" title="minisitesample"  class="alignnone size-full wp-image-408" /></center></p>
<img src="http://feeds.feedburner.com/~r/webjestic/~4/-0KTZshfFS4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://webjestic.net/405/how-to-design-a-mini-site-in-fireworks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://webjestic.net/405/how-to-design-a-mini-site-in-fireworks/</feedburner:origLink></item>
		<item>
		<title>How to Create eCovers (FW+PS)(ebooks)</title>
		<link>http://feedproxy.google.com/~r/webjestic/~3/wXiSVOCZ4U0/</link>
		<comments>http://webjestic.net/396/how-to-create-ecovers-fwpsebooks/#comments</comments>
		<pubDate>Wed, 06 May 2009 18:03:47 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Web Designer]]></category>
		<category><![CDATA[Fireworks]]></category>
		<category><![CDATA[Graphics]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://webjestic.net/?p=396</guid>
		<description><![CDATA[(Please open the article to see the flash file or player.)
I use Adobe products for many things. I&#8217;m not a graphic artist, so I&#8217;ve never been able to master or even make good sense with Photoshop.  However, Adobe Fireworks is easy to learn and a very powerful tool for me as a web developer.
In [...]]]></description>
			<content:encoded><![CDATA[<div style="margin:10px; float:left"><small>(Please open the article to see the flash file or player.)</small></div>
<p>I use Adobe products for many things. I&#8217;m not a graphic artist, so I&#8217;ve never been able to master or even make good sense with Photoshop.  However, Adobe Fireworks is easy to learn and a very powerful tool for me as a web developer.</p>
<p>In this video I use <a href="http://www.adobe.com/downloads/">Adobe Photoshop and Adobe Fireworks</a> to create an ebook cover.</p>
<p>To create modern day Web 2.0 style ebook covers, most everybody uses Action Scripts of some sort.  In this video I am using <a href="http://www.coveractionpro.com/">Cover Action Pro</a> scripts (a commercial product).</p>
<p>This video is about 25 minutes long and shows every step I took to create the eZine eCover in this post.  My style might seem goofy to some Photoshop experts, but I&#8217;m a Fireworks user and all scripts that I am aware of at the moment are for Photoshop.  So, I design the eCover in Fireworks and run the Photoshop scripts on the design.</p>
<p><center><img class="alignnone size-full wp-image-400" title="myecommerceezine400" src="http://webjestic.net/wp-content/uploads/2009/05/myecommerceezine400.jpg" alt="myecommerceezine400" width="395" height="508" /></center></p>
<img src="http://feeds.feedburner.com/~r/webjestic/~4/wXiSVOCZ4U0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://webjestic.net/396/how-to-create-ecovers-fwpsebooks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://webjestic.net/396/how-to-create-ecovers-fwpsebooks/</feedburner:origLink></item>
		<item>
		<title>MySQLQuery Dataset to Create Dynamic Smarty Menus (AppObsess)</title>
		<link>http://feedproxy.google.com/~r/webjestic/~3/pS5c8s5LMlw/</link>
		<comments>http://webjestic.net/383/mysqlquery-dataset-to-create-dynamic-smarty-menus-appobsess/#comments</comments>
		<pubDate>Sat, 02 May 2009 15:09:31 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Delphi for PHP]]></category>
		<category><![CDATA[AppObsess]]></category>

		<guid isPermaLink="false">http://webjestic.net/?p=383</guid>
		<description><![CDATA[(Please open the article to see the flash file or player.)
In this video tutorial I use a MySQL connection to dynamically create a MySQLQuery object, extract menu data from the database, and then create data-driven menu items for a Smarty Template.
This is a continuation from the Connecting to MySQL in Delphi for PHP (AppObsess) post. [...]]]></description>
			<content:encoded><![CDATA[<div style="margin:10px; float:left"><small>(Please open the article to see the flash file or player.)</small></div>
<p>In this video tutorial I use a MySQL connection to dynamically create a MySQLQuery object, extract menu data from the database, and then create data-driven menu items for a Smarty Template.</p>
<p>This is a continuation from the <a href="http://webjestic.net/295/connecting-to-mysql-in-delphi-for-php-appobsess/">Connecting to MySQL in Delphi for PHP (AppObsess)</a> post. </p>
<p>The basic concepts of this video continue to show how to work with the Smarty Templates and how to spin through a MySQLQuery dataset using Delphi for PHP.</p>
<p>If you are familiar with Delphi, then you probably already know how to use the <em>First</em>, <em>Next</em>, <em>Last</em>, and <em>EOF</em> functions of a TDataSet object to spin through the data and collect information using the <em>FieldByName</em> or <em>FindField</em> functions.</p>
<p>The same principle applies in Delphi for PHP and all the basic navigation methods are available.  The only difference in Delphi for PHP is that the fields are in an array property called <strong>Fields</strong> and each field retrieved in the query is accessible via the MySQLQuery->Fields['FieldName'] array elements.</p>
<p>I&#8217;ve created a unit called template_functions.php and added some functions to help build some of the common elements of a template.  The core functionality of creating the query and spinning through the results looks like this:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"> &nbsp; &nbsp;<span class="co1">// Dynamically create the main menu</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">function</span> add_MainMenu<span class="br0">&#40;</span><span class="re0">$sender</span>, <span class="re0">$params</span>, <span class="re0">$MainData</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="re0">$query</span> = <span class="kw2">new</span> MySQLQuery<span class="br0">&#40;</span><span class="re0">$MainData</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="re0">$query</span>-&gt;<span class="me1">Database</span> = <span class="re0">$MainData</span>-&gt;<span class="me1">MySQLDB</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; <span class="re0">$query</span>-&gt;<span class="me1">SQL</span> = <span class="st0">&#8217;select * from menu where menu_type_id = (select id from menu_type where menu_type_name = &quot;MainMenu&quot;)&#8217;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="re0">$query</span>-&gt;<span class="me1">Prepare</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="re0">$query</span>-&gt;<span class="me1">open</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="re0">$query</span>-&gt;<span class="me1">RecordCount</span> &gt; <span class="nu0">0</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$query</span>-&gt;<span class="me1">first</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">while</span> <span class="br0">&#40;</span>! <span class="re0">$query</span>-&gt;<span class="me1">EOF</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$result</span> = <span class="re0">$result</span>. <span class="st0">&#8216;&lt;li&gt;&lt;a href=&quot;&#8217;</span>.<span class="re0">$query</span>-&gt;<span class="me1">Fields</span><span class="br0">&#91;</span><span class="st0">&#8216;menu_url&#8217;</span><span class="br0">&#93;</span>.<span class="st0">&#8216;&quot;&gt;&#8217;</span>.<span class="re0">$query</span>-&gt;<span class="me1">Fields</span><span class="br0">&#91;</span><span class="st0">&#8216;menu_name&#8217;</span><span class="br0">&#93;</span>.<span class="st0">&#8216;&lt;/a&gt;&lt;/li&gt;&#8217;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$query</span>-&gt;<span class="me1">next</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$result</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>I&#8217;ve also added two new tables to the database.  As time goes by I&#8217;ll be adding ALTER statements and adapting the database structure as I continue playing with this project.  I might not always add the SQL in the posting, but it will always be included in the downloadable project .ZIP file.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">CREATE</span> <span class="kw1">TABLE</span> menu_type <span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; id bigint<span class="br0">&#40;</span><span class="nu0">20</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span> <span class="kw1">AUTO_INCREMENT</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; menu_type_name varchar<span class="br0">&#40;</span><span class="nu0">60</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; menu_type_desc varchar<span class="br0">&#40;</span><span class="nu0">200</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span>,</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">UNIQUE</span> <span class="kw1">KEY</span> menu_type_name <span class="br0">&#40;</span>menu_type_name<span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">PRIMARY</span> <span class="kw1">KEY</span> <span class="br0">&#40;</span>id, menu_type_name<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#41;</span> TYPE=InnoDB <span class="kw1">DEFAULT</span> CHARSET=UTF8 <span class="kw1">AUTO_INCREMENT</span>=<span class="nu0">1000</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2"><span class="kw1">CREATE</span> <span class="kw1">TABLE</span> menu <span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; id bigint<span class="br0">&#40;</span><span class="nu0">20</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span> <span class="kw1">AUTO_INCREMENT</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; menu_type_id bigint<span class="br0">&#40;</span><span class="nu0">20</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; menu_name varchar<span class="br0">&#40;</span><span class="nu0">60</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; menu_url text <span class="kw1">NOT</span> <span class="kw1">NULL</span>,</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">UNIQUE</span> <span class="kw1">KEY</span> menu_name <span class="br0">&#40;</span>menu_name, menu_type_id<span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">PRIMARY</span> <span class="kw1">KEY</span> <span class="br0">&#40;</span>id, menu_name<span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">FOREIGN</span> <span class="kw1">KEY</span> <span class="br0">&#40;</span>menu_type_id<span class="br0">&#41;</span> <span class="kw1">REFERENCES</span> menu_type<span class="br0">&#40;</span>id<span class="br0">&#41;</span> <span class="kw1">ON</span> <span class="kw1">DELETE</span> CASCADE</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#41;</span> TYPE=InnoDB <span class="kw1">DEFAULT</span> CHARSET=UTF8 <span class="kw1">AUTO_INCREMENT</span>=<span class="nu0">1000</span>;</div>
</li>
</ol>
</div>
<p>If you would like to download this application in the state it is for this video, you can download it using the link below.  The .SQL file, the template, and the Delphi for PHP project code is all included.</p>
<p><strong>Free Membership Required</strong>: Please <a href="/amember/login.php?amember_redirect_url=/feed/?redirect_to=/feed/">Login</a> or <a href="/amember/signup.php">Register</a> to read the rest of this content.</p>
<img src="http://feeds.feedburner.com/~r/webjestic/~4/pS5c8s5LMlw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://webjestic.net/383/mysqlquery-dataset-to-create-dynamic-smarty-menus-appobsess/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://webjestic.net/383/mysqlquery-dataset-to-create-dynamic-smarty-menus-appobsess/</feedburner:origLink></item>
		<item>
		<title>Syntax Highlighted Source Code in WordPress</title>
		<link>http://feedproxy.google.com/~r/webjestic/~3/KLn9_8QPflg/</link>
		<comments>http://webjestic.net/317/syntax-highlighted-source-code-in-wordpress/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 19:08:04 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Wordpress Webmaster]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://webjestic.net/?p=317</guid>
		<description><![CDATA[Adding syntax highlighted source code in WordPress doesn&#8217;t come without a plugin.  WordPress by nature strips out any potentially dangerous code in the posts and pages, protecting you from yourself.   There are two very good plugins to accomplish this.  1) SyntaxHighlighter2 and 2) Dean&#8217;s Code Highlighter.  Both are good.
I prefer the first, but there are [...]]]></description>
			<content:encoded><![CDATA[<p>Adding syntax highlighted source code in WordPress doesn&#8217;t come without a plugin.  WordPress by nature strips out any potentially dangerous code in the posts and pages, protecting you from yourself.   There are two very good plugins to accomplish this.  <strong>1)</strong> <a href="http://mohanjith.com/wordpress/syntaxhighlighter2.html">SyntaxHighlighter2</a> and <strong>2)</strong> <a href="http://www.deanlee.cn/wordpress/code_highlighter_plugin_for_wordpress/">Dean&#8217;s Code Highlighter</a>.  Both are good.</p>
<p>I prefer the first, but there are some problems with it when using some themes in WordPress and the current theme I have installed is one of them.  To post source code with this plugin in WordPress, you place your code between the [sourcecode language="php"] [/sourcecode] tags.</p>
<p>The 2nd almost always works and I&#8217;m using it in this theme now.  Using Dean&#8217;s Code Highlighter I can place my source code between the &lt;pre lang=&#8221;PHP&#8221;&gt; &lt;/pre&gt; tags in my WordPress HTML editor and preserve code formatting and have intelligent syntax highlighting, based on GeSHi.</p>
<p><strong>&#8220;Delphi&#8221;</strong> Sample:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">for</span> <span class="br0">&#40;</span>x := <span class="nu0">0</span> <span class="kw1">to</span> <span class="nu0">100</span><span class="br0">&#41;</span> <span class="kw1">do</span> <span class="kw1">begin</span> </div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">end</span>;</div>
</li>
</ol>
</div>
<p><strong>&#8220;PHP&#8221;</strong> Sample:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">for</span> <span class="br0">&#40;</span><span class="re0">$x</span>= <span class="nu0">0</span>; <span class="re0">$x</span>= <span class="nu0">100</span>; <span class="re0">$x</span>++<span class="br0">&#41;</span> <span class="br0">&#123;</span> </div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p><strong>&#8220;JavaScript&#8221;</strong> Sample:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">for</span><span class="br0">&#40;</span>i = <span class="nu0">0</span>; i &lt; <span class="nu0">5</span>; i++<span class="br0">&#41;</span><span class="br0">&#123;</span> </div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p><strong>&#8220;CSS&#8221;</strong> Sample:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">body <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">background-color</span>: Black;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p><strong>&#8220;XML&#8221;</strong> Sample:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;?xml</span> <span class="re0">version</span>=<span class="st0">&quot;1.0&quot;</span> <span class="re0">encoding</span>=<span class="st0">&quot;UTF-8&quot;</span><span class="re2">?&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;urlset</span> <span class="re0">xmlns</span>=<span class="st0">&quot;http://www.google.com/schemas/sitemap/0.84&quot;</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;url<span class="re2">&gt;</span></span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;loc<span class="re2">&gt;</span></span></span>http://webjestic.net/<span class="sc3"><span class="re1">&lt;/loc<span class="re2">&gt;</span></span></span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;changefreq<span class="re2">&gt;</span></span></span>weekly<span class="sc3"><span class="re1">&lt;/changefreq<span class="re2">&gt;</span></span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;priority<span class="re2">&gt;</span></span></span>0.5<span class="sc3"><span class="re1">&lt;/priority<span class="re2">&gt;</span></span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/url<span class="re2">&gt;</span></span></span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;/urlset<span class="re2">&gt;</span></span></span></div>
</li>
</ol>
</div>
<p><strong>&#8220;XHTML&#8221;</strong> Sample:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; dir=&quot;ltr&quot; lang=&quot;en-US&quot;&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;head profile=&quot;http://gmpg.org/xfn/11&quot;&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
</div>
</li>
<li class="li2">
<div class="de2">&lt;/head&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;body&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;/body&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;/html&gt;</div>
</li>
</ol>
</div>
<p>For a complete listing of all the supported languages, visit <a href="http://qbnz.com/highlighter">GeSHi</a>.</p>
<img src="http://feeds.feedburner.com/~r/webjestic/~4/KLn9_8QPflg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://webjestic.net/317/syntax-highlighted-source-code-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://webjestic.net/317/syntax-highlighted-source-code-in-wordpress/</feedburner:origLink></item>
		<item>
		<title>Connecting to MySQL in Delphi for PHP (AppObsess)</title>
		<link>http://feedproxy.google.com/~r/webjestic/~3/Q7aYaxFR3xk/</link>
		<comments>http://webjestic.net/295/connecting-to-mysql-in-delphi-for-php-appobsess/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 07:14:45 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Delphi for PHP]]></category>
		<category><![CDATA[AppObsess]]></category>

		<guid isPermaLink="false">http://webjestic.net/?p=295</guid>
		<description><![CDATA[(Please open the article to see the flash file or player.)
In this video tutorial I begin building an ongoing project called AppObsess, which I will use as a generic and very simple application engine using the Smarty Template engine and the MySQL database.  I begin this video series having applied the techniques from the [...]]]></description>
			<content:encoded><![CDATA[<div style="margin:10px; float:left"><small>(Please open the article to see the flash file or player.)</small></div>
<p>In this video tutorial I begin building an ongoing project called AppObsess, which I will use as a generic and very simple application engine using the Smarty Template engine and the MySQL database.  I begin this video series having applied the techniques from the other video&#8217;s:  <a href="http://webjestic.net/282/creating-editable-forms-for-smarty-templates-in-delphi-for-php/">Creating Editable Forms for Smarty Templates</a> and <a href="http://webjestic.net/267/creating-dynamic-delphi-for-php-smarty-variables/">Creating Dynamic Smarty Variables</a> in Delphi for PHP.</p>
<p>Connecting to a MySQL database in Delphi for PHP is an extremely simple task.  In this video I create a data module and a config file containing the connection strings, include the files and execute the program.  That&#8217;s the entire video in a nutshell.  Most of the video is spent getting up to speed on the state of the application.</p>
<p>The core code is written in a file called maindb.php (the data module) and it looks like this:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re0">$MainData</span>-&gt;<span class="me1">MySQLDB</span>-&gt;<span class="me1">Host</span> = HOSTNAME;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$MainData</span>-&gt;<span class="me1">MySQLDB</span>-&gt;<span class="me1">DatabaseName</span> = DATABASE;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$MainData</span>-&gt;<span class="me1">MySQLDB</span>-&gt;<span class="me1">UserName</span> = USERNAME;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$MainData</span>-&gt;<span class="me1">MySQLDB</span>-&gt;<span class="me1">UserPassword</span> = PASSWORD;</div>
</li>
<li class="li2">
<div class="de2"><span class="re0">$MainData</span>-&gt;<span class="me1">MySQLDB</span>-&gt;<span class="me1">Open</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span>! <span class="re0">$MainData</span>-&gt;<span class="me1">MySQLDB</span>-&gt;<span class="me1">Connected</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="br0">&#40;</span><span class="st0">&quot;Unable to connect to &quot;</span> . DATABASE . <span class="st0">&quot;<span class="es0">\r</span><span class="es0">\n</span>&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <a href="http://www.php.net/exit"><span class="kw3">exit</span></a> <span class="br0">&#40;</span><span class="st0">&quot;maindb.php MainData-&gt;MySQLDB critical error&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>As always, you should have much better error control handling then I added for this simple tutorial.  My connection testing was just to make sure something stupid didn&#8217;t happen while I was creating this video.</p>
<p>The config.inc file is very simple as well and only contains the connection strings for MySQL.  It looks like this:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"> &nbsp; &nbsp;<a href="http://www.php.net/define"><span class="kw3">DEFINE</span></a><span class="br0">&#40;</span><span class="st0">&#8216;HOSTNAME&#8217;</span>, <span class="st0">&#8216;localhost&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <a href="http://www.php.net/define"><span class="kw3">DEFINE</span></a><span class="br0">&#40;</span><span class="st0">&#8216;DATABASE&#8217;</span>, <span class="st0">&#8216;obsess&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <a href="http://www.php.net/define"><span class="kw3">DEFINE</span></a><span class="br0">&#40;</span><span class="st0">&#8216;USERNAME&#8217;</span>, <span class="st0">&#8216;obsess&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <a href="http://www.php.net/define"><span class="kw3">DEFINE</span></a><span class="br0">&#40;</span><span class="st0">&#8216;PASSWORD&#8217;</span>, <span class="st0">&#8216;demo&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>The starting template I am using for this AppObsess web framework in Delphi for PHP is the Blue Obsess template available from my <a href="http://webjestic.net/templates/">XHTML/CSS Templates</a> page.</p>
<p>The starting database SQL I have for this application is:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">DROP</span> <span class="kw1">DATABASE</span> <span class="kw1">IF</span> <span class="kw1">EXISTS</span> obsess;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">CREATE</span> <span class="kw1">DATABASE</span> <span class="kw1">IF</span> <span class="kw1">NOT</span> <span class="kw1">EXISTS</span> obsess;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">USE</span> obsess;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2"><span class="kw1">CREATE</span> <span class="kw1">TABLE</span> page <span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; id bigint<span class="br0">&#40;</span><span class="nu0">20</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span> <span class="kw1">AUTO_INCREMENT</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; page_name varchar<span class="br0">&#40;</span><span class="nu0">200</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; page_body text <span class="kw1">NOT</span> <span class="kw1">NULL</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">UNIQUE</span> <span class="kw1">KEY</span> page_name <span class="br0">&#40;</span>page_name<span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">PRIMARY</span> <span class="kw1">KEY</span> <span class="br0">&#40;</span>id, page_name<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#41;</span> TYPE=InnoDB <span class="kw1">DEFAULT</span> CHARSET=UTF8 <span class="kw1">AUTO_INCREMENT</span>=<span class="nu0">1000</span>;</div>
</li>
</ol>
</div>
<p>If you would like to download this application in the state it is for this video, you can download it using the link below.  The .SQL file, the template, and the Delphi for PHP project code is all included.</p>
<p><strong>Free Membership Required</strong>: Please <a href="/amember/login.php?amember_redirect_url=/feed/?redirect_to=/feed/">Login</a> or <a href="/amember/signup.php">Register</a> to read the rest of this content.</p>
<img src="http://feeds.feedburner.com/~r/webjestic/~4/Q7aYaxFR3xk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://webjestic.net/295/connecting-to-mysql-in-delphi-for-php-appobsess/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://webjestic.net/295/connecting-to-mysql-in-delphi-for-php-appobsess/</feedburner:origLink></item>
		<item>
		<title>Creating Editable Forms for Smarty Templates in Delphi for PHP</title>
		<link>http://feedproxy.google.com/~r/webjestic/~3/rFghXgUqV4k/</link>
		<comments>http://webjestic.net/282/creating-editable-forms-for-smarty-templates-in-delphi-for-php/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 14:10:30 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Delphi for PHP]]></category>

		<guid isPermaLink="false">http://webjestic.net/?p=282</guid>
		<description><![CDATA[(Please open the article to see the flash file or player.)
Once you begin working with the Smarty Template engine in Delphi for PHP and once you learn how to include and update smarty variable tags, you&#8217;ll want to start including work areas for your data forms.  With a lack of VCL documentation, it&#8217;s not [...]]]></description>
			<content:encoded><![CDATA[<div style="margin:10px; float:left"><small>(Please open the article to see the flash file or player.)</small></div>
<p>Once you begin working with the Smarty Template engine in Delphi for PHP and once you learn how to include and update smarty variable tags, you&#8217;ll want to start including work areas for your data forms.  With a lack of VCL documentation, it&#8217;s not obvious how to get your controls in the smarty template and get them positioned correctly.</p>
<p>Additionally, for several days I was stumped as to why I couldn&#8217;t get my Button code to execute when I used a smarty template.  This video shows how to accomplish all these tasks.  This video extends the lesson in <a href="http://webjestic.net/267/creating-dynamic-delphi-for-php-smarty-variables/">Creating Dynamic Smarty Variables in Delphi for PHP</a> and in <a href="http://webjestic.net/211/hello-world-delphi-for-php/">Hello World (Delphi for PHP)</a>.</p>
<p>The main thing to remember in all of these lessons is that in obtaining the desired effect, we are basically configuring the proper Object Inspector Properties or extending the code within the Object Inspector Events for the proper objects.</p>
<img src="http://feeds.feedburner.com/~r/webjestic/~4/rFghXgUqV4k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://webjestic.net/282/creating-editable-forms-for-smarty-templates-in-delphi-for-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://webjestic.net/282/creating-editable-forms-for-smarty-templates-in-delphi-for-php/</feedburner:origLink></item>
		<item>
		<title>Creating Dynamic Smarty Variables in Delphi for PHP</title>
		<link>http://feedproxy.google.com/~r/webjestic/~3/SHi8m5FVdY8/</link>
		<comments>http://webjestic.net/267/creating-dynamic-delphi-for-php-smarty-variables/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 18:23:26 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Delphi for PHP]]></category>

		<guid isPermaLink="false">http://webjestic.net/?p=267</guid>
		<description><![CDATA[(Please open the article to see the flash file or player.)
One of the first things you&#8217;ll notice when you begin working with Smarty Templates in the Delphi for PHP environment is that it&#8217;s not obvious how you can include custom or dynamic smarty variable tags into your template from Delphi for PHP.
This video was created [...]]]></description>
			<content:encoded><![CDATA[<div style="margin:10px; float:left"><small>(Please open the article to see the flash file or player.)</small></div>
<p>One of the first things you&#8217;ll notice when you begin working with Smarty Templates in the Delphi for PHP environment is that it&#8217;s not obvious how you can include custom or dynamic smarty variable tags into your template from Delphi for PHP.</p>
<p>This video was created to demonstrate exactly how to get dynamic smarty variables into your smarty templates and display the correct variable information.  The main thing to know and understand is, that the VCL in Delphi for PHP has a certain time it executes the Smarty Engine events.</p>
<p>To access the correct time and place to assign your variables is to use the Forms-&gt;OnTemplate event and access the smarty object through the provided $params.  In this video I&#8217;ve created 3 dynamic smarty tag variables.  $MyTitle, $MyDescription, and $MyKewords.  I assign the values of these variables in Delphi for PHP and placed them in the HTML smarty template.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">function</span> Unit1Template<span class="br0">&#40;</span><span class="re0">$sender</span>, <span class="re0">$params</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$template</span> = <span class="re0">$params</span><span class="br0">&#91;</span><span class="st0">&#8216;template&#8217;</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$template</span>-&gt;_smarty-&gt;<span class="me1">assign</span><span class="br0">&#40;</span><span class="st0">&#8216;MyTitle&#8217;</span>, <span class="st0">&#8216;My Custom Page Title&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$template</span>-&gt;_smarty-&gt;<span class="me1">assign</span><span class="br0">&#40;</span><span class="st0">&#8216;MyDescription&#8217;</span>, <span class="st0">&#8216;My Custom description&#8230;&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$template</span>-&gt;_smarty-&gt;<span class="me1">assign</span><span class="br0">&#40;</span><span class="st0">&#8216;MyKeywords&#8217;</span>, <span class="st0">&#8216;keyword 1, Smarty Keyword&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>If you&#8217;ve found this video posting useful, you might also be interested in the video posting that extends this lesson: <a href="http://webjestic.net/282/creating-editable-forms-for-smarty-templates-in-delphi-for-php/">Creating Editable Forms for Smarty Templates in Delphi for PHP</a>.</p>
<img src="http://feeds.feedburner.com/~r/webjestic/~4/SHi8m5FVdY8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://webjestic.net/267/creating-dynamic-delphi-for-php-smarty-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://webjestic.net/267/creating-dynamic-delphi-for-php-smarty-variables/</feedburner:origLink></item>
	</channel>
</rss>
