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

<channel>
	<title>webJestic.NET &#187; Delphi for PHP</title>
	<atom:link href="http://webjestic.net/category/delphi-for-php/feed/" rel="self" type="application/rss+xml" />
	<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.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>MySQLQuery Dataset to Create Dynamic Smarty Menus (AppObsess)</title>
		<link>http://webjestic.net/383/mysqlquery-dataset-to-create-dynamic-smarty-menus-appobsess/</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=/category/delphi-for-php/feed/?redirect_to=/category/delphi-for-php/feed/">Login</a> or <a href="/amember/signup.php">Register</a> to read the rest of this content.</p>
]]></content:encoded>
			<wfw:commentRss>http://webjestic.net/383/mysqlquery-dataset-to-create-dynamic-smarty-menus-appobsess/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Connecting to MySQL in Delphi for PHP (AppObsess)</title>
		<link>http://webjestic.net/295/connecting-to-mysql-in-delphi-for-php-appobsess/</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=/category/delphi-for-php/feed/?redirect_to=/category/delphi-for-php/feed/">Login</a> or <a href="/amember/signup.php">Register</a> to read the rest of this content.</p>
]]></content:encoded>
			<wfw:commentRss>http://webjestic.net/295/connecting-to-mysql-in-delphi-for-php-appobsess/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating Editable Forms for Smarty Templates in Delphi for PHP</title>
		<link>http://webjestic.net/282/creating-editable-forms-for-smarty-templates-in-delphi-for-php/</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>
]]></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>
		</item>
		<item>
		<title>Creating Dynamic Smarty Variables in Delphi for PHP</title>
		<link>http://webjestic.net/267/creating-dynamic-delphi-for-php-smarty-variables/</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>
]]></content:encoded>
			<wfw:commentRss>http://webjestic.net/267/creating-dynamic-delphi-for-php-smarty-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello World (Delphi for PHP)</title>
		<link>http://webjestic.net/211/hello-world-delphi-for-php/</link>
		<comments>http://webjestic.net/211/hello-world-delphi-for-php/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 08:25:22 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Delphi for PHP]]></category>

		<guid isPermaLink="false">http://webjestic.net/?p=211</guid>
		<description><![CDATA[This is the very first and very basic &#8220;hello world&#8221; program with a few edit controls and a submit button, using Delphi for PHP.  There is nothing complicated about this application.  The entire purpose of this is to illustrate how to manipulate a Label by use of the OnClick event of a Button.
While Delphi for [...]]]></description>
			<content:encoded><![CDATA[<p>This is the very first and very basic &#8220;hello world&#8221; program with a few edit controls and a submit button, using Delphi for PHP.  There is nothing complicated about this application.  The entire purpose of this is to illustrate how to manipulate a Label by use of the OnClick event of a Button.</p>
<p>While Delphi for PHP is currently at version 2, it still has a lot of growth left.  Nevertheless, this IDE is an excellent IDE for writing and developing PHP code and applications.  Using the VCL is an option and not a requirement.  If you wish to use the VCL controls, then of course the Forms and VCL is needed.</p>
<div style="margin:10px; float:left"><small>(Please open the article to see the flash file or player.)</small></div>
<p><strong>Note</strong>:  I&#8217;ve found the Delphi for PHP IDE a little picky if not delicate.  I&#8217;ve had times when I&#8217;ve built this project and the button doesn&#8217;t work.  I&#8217;ve discovered the reason is environment variables which define where the VCL is located in the path.  The default project location is included in your path, so if you create a special folder on another drive, perhaps you too will epxerience problems with the button not being executed properly.  When you &#8220;distribute&#8221; the application and it&#8217;s packages, the paths work fine.  It&#8217;s only during development in the IDE and Debug Listener, where you may experience such problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://webjestic.net/211/hello-world-delphi-for-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
