<?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>Andrey Khomyakov technical blog</title>
	<atom:link href="http://andreytech.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://andreytech.com</link>
	<description>sharing my knowledge with world</description>
	<lastBuildDate>Tue, 27 Dec 2011 22:03:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Stop joomla from caching system messages</title>
		<link>http://andreytech.com/stop-joomla-from-caching-system-messages/</link>
		<comments>http://andreytech.com/stop-joomla-from-caching-system-messages/#comments</comments>
		<pubDate>Tue, 27 Dec 2011 22:03:34 +0000</pubDate>
		<dc:creator>Andrey</dc:creator>
				<category><![CDATA[Joomla]]></category>

		<guid isPermaLink="false">http://andreytech.com/?p=134</guid>
		<description><![CDATA[<p>If you are running joomla 1.5 or 1.7 with caching turned on, you might have seen that sometimes system messages are getting cached and are shown every time you access some page.<br /> It can even happen that users see messages of other users.<br /> Anyway, I came up with a solution for that.<br /> [...]]]></description>
			<content:encoded><![CDATA[<p>If you are running joomla 1.5 or 1.7 with caching turned on, you might have seen that sometimes system messages are getting cached and are shown every time you access some page.<br />
It can even happen that users see messages of other users.<br />
Anyway, I came up with a solution for that.<br />
I made it for joomla 1.7, but it should work similar for 1.5.<br />
Here is what you need to do:<br />
- Open /libraries/joomla/application/application.php<br />
- Find getMessageQueue() function<br />
- Add code so function look like this:</p>
<pre>
	public function getMessageQueue()
	{
		// For empty queue, if messages exists in the session, enqueue them.
		if (!count($this->_messageQueue)) {
			$session = JFactory::getSession();
			$sessionQueue = $session->get('application.queue');

			if (count($sessionQueue)) {
				$input = new JInput();
				$rand_token = $input->get('rand_token');
				if(!$rand_token) {
					$uri =&#038; JURI::getInstance();
					$query = $uri->getQuery(1);
					$query['rand_token'] = md5(rand());
					$uri->setQuery($query);
					$unique_url = $uri->toString( );
					header('Location: '.$unique_url);
					exit;
				}
				$this->_messageQueue = $sessionQueue;
				$session->set('application.queue', null);
			}
		}

		return $this->_messageQueue;
	}
</pre>
<p>This code is adding rand_token parameter to url every time system message is generated, so it makes url unique and joomla cache will not use it again.<br />
Hope this will help you with your joomla system messages issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://andreytech.com/stop-joomla-from-caching-system-messages/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to get orginal joomla GET url query from SEF URL</title>
		<link>http://andreytech.com/how-to-get-orginal-joomla-get-url-query-from-sef-url/</link>
		<comments>http://andreytech.com/how-to-get-orginal-joomla-get-url-query-from-sef-url/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 12:11:55 +0000</pubDate>
		<dc:creator>Andrey</dc:creator>
				<category><![CDATA[Joomla]]></category>

		<guid isPermaLink="false">http://andreytech.com/?p=131</guid>
		<description><![CDATA[<p>While working with joomla sites, it is important to have SEF URLs instead of regular old-style urls like /index.php?option=com_content&#038;view=article&#038;id=12&#038;Itemid=8 because it is so much important for website search engine rankings. But when you see SEF URL in address bar, sometimes it is hard to say what article id or menu id or even component it [...]]]></description>
			<content:encoded><![CDATA[<p>While working with joomla sites, it is important to have SEF URLs instead of regular old-style urls like /index.php?option=com_content&#038;view=article&#038;id=12&#038;Itemid=8 because it is so much important for website search engine rankings. But when you see SEF URL in address bar, sometimes it is hard to say what article id or menu id or even component it is associated with.<br />
So I came up with a simple solution that can give you all page details that are hidden behind SEF URL while you are looking at page.<br />
It is information block that show up in very bottom of page, only if you are logged in as Super User. This solution I created for joomla 1.7, but with small modifications you can make it work for joomla 1.5 as well.<br />
Here&#8217;s how it looks like:<br />
<a href="/wp-content/uploads/2011/12/url_query_information.png"><img src="/wp-content/uploads/2011/12/url_query_information.png" alt="Original query information" title="url_query_information" width="590" class="alignnone size-full wp-image-132" /></a><br />
To make it work you will need to edit your /index.php file in root folder of your joomla installation and add following code in very end of file:</p>
<pre>
	$user_obj =&amp; JFactory::getUser();
	if(!isset($user_obj-&gt;groups[&#039;Super Users&#039;])) {
		return;
	}
		$input = new JInput();
		$option = $input-&gt;get(&#039;option&#039;);
		$view = $input-&gt;get(&#039;view&#039;);
		$layout = $input-&gt;get(&#039;layout&#039;);
		$id = $input-&gt;get(&#039;id&#039;);
		$Itemid = $input-&gt;get(&#039;Itemid&#039;);
		$query_string = http_build_query(JRequest::get( &#039;get&#039; ));

		if(
			($option == &#039;com_media&#039; &amp;&amp; $view == &#039;imagesList&#039;)
			|| ($option == &#039;com_media&#039; &amp;&amp; $view == &#039;images&#039;)
			|| ($option == &#039;com_content&#039; &amp;&amp; $view == &#039;articles&#039; &amp;&amp; $layout == &#039;modal&#039;)
			|| ($option == &#039;com_content&#039; &amp;&amp; $view == &#039;article&#039; &amp;&amp; $layout == &#039;pagebreak&#039;)
		) {
			return;
		}
?&gt;
&lt;div&gt;
	&lt;p style=&quot;font-size: 24px;&quot;&gt;
		Query: &lt;?php echo $query_string;?&gt;
		&lt;br&gt; Component: &lt;?php echo $option;?&gt;
		&lt;br&gt; View: &lt;?php echo $view;?&gt;
		&lt;br&gt; Layout: &lt;?php echo $layout;?&gt;
		&lt;br&gt; ID: &lt;?php echo $id;?&gt;
		&lt;br&gt; Menu item id: &lt;?php echo $Itemid;?&gt;
	&lt;/p&gt;
&lt;/div&gt;
</pre>
<p>This solution will help you find out menu id or article id or any other information that is hidden by SEF URL for any page when using default joomla SEF or any components for joomla SEF URLs like sh404SEF.</p>
]]></content:encoded>
			<wfw:commentRss>http://andreytech.com/how-to-get-orginal-joomla-get-url-query-from-sef-url/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating CRUD admin panel in Codeigniter</title>
		<link>http://andreytech.com/creating-crud-admin-panel-in-codeigniter/</link>
		<comments>http://andreytech.com/creating-crud-admin-panel-in-codeigniter/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 14:37:51 +0000</pubDate>
		<dc:creator>Andrey</dc:creator>
				<category><![CDATA[Data manager]]></category>

		<guid isPermaLink="false">http://andreytech.com/?p=96</guid>
		<description><![CDATA[<p>Earlier I&#8217;ve shown <a href="/creating-php-crud-admin-panel-using-data-manager-library/">how to create a CRUD admin panel using plain php</a>. In this article I will explain how you can do it using Codeigniter.<br /> Steps, will be pretty much the same, even easier because I already wrote files that will automate most parts for Codeigniter.<br /> Let&#8217;s say we need to [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier I&#8217;ve shown <a href="/creating-php-crud-admin-panel-using-data-manager-library/">how to create a CRUD admin panel using plain php</a>. In this article I will explain how you can do it using Codeigniter.<br />
Steps, will be pretty much the same, even easier because I already wrote files that will automate most parts for Codeigniter.<br />
Let&#8217;s say we need to create an admin panel for an eCommerce website, we have a <a href="/wp-content/uploads/2011/12/ecommerce_db.zip">products and categories db tables</a> and we need to create a CRUD admin panel for products.</p>
<h2>So, let&#8217;s start!</h2>
<p>- First, <a href="http://codeigniter.com/download.php">download</a> and <a href="http://codeigniter.com/user_guide/installation/index.html">install</a> Codeigniter( I will be using Codeigniter 2.1.0 in this tutorial ). Make sure that you set your database connection settings in /application/config/database.php and included &#8216;database&#8217; to list of libraries that will be autoloaded in /application/config/autoload.php , we will also need &#8216;url&#8217; helper, so please add it to autoload as well.<br />
- <a href="https://github.com/andreytech/Data-manager/zipball/master">Download Data manager library</a>, extract contents of archive in your root folder and rename extracted folder to say &#8216;data_manager&#8217;.<br />
- Replace /data_manager/params.php with one from <a href="/wp-content/uploads/2011/12/params.zip">this archive</a>. It will make Data manager retrieve database connection settings and daseurl from Codeigniter config files.<br />
- Next step is creating Data manager profile file which will tell Data manager what exactly we need to do. For our &#8216;products&#8217; db table, let&#8217;s create a /data_manager/profiles/products_admin.php profile file with following contents:</p>
<pre>
&lt;?php
$table = &#039;products&#039;;

$fields = array (
	array (
		&#039;name&#039; =&gt; &#039;id&#039;
		, &#039;type&#039; =&gt; &#039;key&#039;
		, &#039;title&#039; =&gt; &#039;ID&#039;
	)
	, array (
		&#039;name&#039; =&gt; &#039;productCode&#039;
		, &#039;type&#039; =&gt; &#039;input&#039;
		, &#039;title&#039; =&gt; &#039;Code&#039;
	)
	, array (
		&#039;name&#039; =&gt; &#039;productName&#039;
		, &#039;type&#039; =&gt; &#039;input&#039;
		, &#039;title&#039; =&gt; &#039;Name&#039;
		, &#039;is_link&#039; =&gt; 1
		, &#039;link&#039; =&gt; &#039;/products/edit/*&#039;
	)
	, array (
		&#039;name&#039; =&gt; &#039;category_id&#039;
		, &#039;type&#039; =&gt; &#039;lookup&#039;
		, &#039;title&#039; =&gt; &#039;Category&#039;
		//lookup field specific parameters
		, &#039;lookup_table&#039; =&gt; &#039;categories&#039;
		, &#039;key_field&#039; =&gt; &#039;id&#039;
		, &#039;values_field&#039; =&gt; &#039;title&#039;
	)
	, array (
		&#039;name&#039; =&gt; &#039;productScale&#039;
		, &#039;type&#039; =&gt; &#039;list&#039;
		, &#039;title&#039; =&gt; &#039;Scale&#039;
		, &#039;items&#039; =&gt; array(
			&quot;1:10&quot; =&gt; &quot;1:10( minimal )&quot;
			, &quot;1:12&quot; =&gt; &quot;1:12( tiny )&quot;
			, &quot;1:18&quot; =&gt; &quot;1:18( average )&quot;
			, &quot;1:24&quot; =&gt; &quot;1:24( big )&quot;
			, &quot;1:32&quot; =&gt; &quot;1:32( maximal )&quot;
		)
		, &#039;list_mode&#039; =&gt; 0
	)
	, array (
		&#039;name&#039; =&gt; &#039;productDescription&#039;
		, &#039;type&#039; =&gt; &#039;textarea&#039;
		, &#039;title&#039; =&gt; &#039;Description&#039;
		, &#039;rows&#039; =&gt; 5
		, &#039;cols&#039; =&gt; 60
		, &#039;list_mode&#039; =&gt; 0
	)
	, array (
		&#039;name&#039; =&gt; &#039;buyPrice&#039;
		, &#039;type&#039; =&gt; &#039;input&#039;
		, &#039;title&#039; =&gt; &#039;Price&#039;
		, &#039;css_class&#039; =&gt; &#039;product_price&#039;
	)

	, array (
		&#039;name&#039; =&gt; &#039;is_active&#039;
		, &#039;type&#039; =&gt; &#039;check&#039;
		, &#039;title&#039; =&gt; &#039;Is active&#039;
	)
	, array (
		&#039;name&#039; =&gt; &#039;managing&#039;
		, &#039;type&#039; =&gt; &#039;managing&#039;
		, &#039;title&#039; =&gt; &#039;Actions&#039;
		, &#039;delete_link&#039; =&gt; &#039;/products/delete/*&#039;
		, &#039;edit_link&#039; =&gt; &#039;/products/edit/*&#039;
		, &#039;non_db&#039; =&gt; 1
		, &#039;single_mode&#039; =&gt; 0
	)
);
</pre>
<p>Variable $table is telling Data manager that we will be working with &#8216;products&#8217; db table.<br />
Variable $fields is array of fields that will be used for our admin panel. What each field does you can see from result, parameters are mostly self-explanatory, but you can also look at <a href="/explaining-data-manager-field-parameters/" target="_blank">detailed explanation of Data manager fields parameters</a>.</p>
<p>- Next step is to create controller and views. <a href="/wp-content/uploads/2011/12/sample_controller_and_views.zip">Download archive</a> with sample controller and views and extract it to /application folder.<br />
- Rename controller file and folder inside views folder from &#8216;sample_controller&#8217; to a name of controller that you want to use. In out case let&#8217;s use controller name &#8216;products&#8217;.<br />
After that open controller file ( /application/controllers/products.php ), rename controller class name to &#8216;Products&#8217; and change value for class variable $dm_profile to our Data manager profile name ( &#8216;products_admin&#8217; ) to make it look like this:</p>
<pre>
&lt;?php
include_once BASEPATH.&#039;../data_manager/DataManager.php&#039;;

class Products extends CI_Controller {
	private $dm_profile = &#039;products_admin&#039;;
	private $controller = &#039;&#039;;
...
</pre>
<h2>And that&#8217;s it!!!</h2>
<p>You asking &#8220;Soooo easy?&#8221; &#8211; Yes, so easy!</p>
<p>So if you access http://your_domain/products you will see something like this:<br />
<a href="/wp-content/uploads/2011/12/products_list.png"><img src="/wp-content/uploads/2011/12/products_list.png" alt="admin panel built with Data manager" title="products_list" width="590" class="alignnone size-full wp-image-111" /></a><br />
And if you click &#8216;Edit&#8217; link in front of any item, or item title you will see this:<br />
<a href="/wp-content/uploads/2011/12/product_editing_page.png"><img src="/wp-content/uploads/2011/12/product_editing_page.png" alt="Item editing page built with Data manager" title="product_editing_page" width="590" class="alignnone size-full wp-image-113" /></a></p>
<p><a href="/wp-content/uploads/2011/12/dm_ci_sources.zip">Here</a> you can download complete sources of this demo project with a database.<br />
You can change controllers and views files to make this admin panel look and work more like you want it to look, it is just a demo that shows basic usage of Data manager library.<br />
So keep in touch with new tutorials and new versions of Data manager.</p>
]]></content:encoded>
			<wfw:commentRss>http://andreytech.com/creating-crud-admin-panel-in-codeigniter/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>What is Data manager?</title>
		<link>http://andreytech.com/what-is-data-manager/</link>
		<comments>http://andreytech.com/what-is-data-manager/#comments</comments>
		<pubDate>Fri, 02 Dec 2011 10:27:09 +0000</pubDate>
		<dc:creator>Andrey</dc:creator>
				<category><![CDATA[Data manager]]></category>
		<category><![CDATA[My projects]]></category>

		<guid isPermaLink="false">http://andreytech.com/?p=66</guid>
		<description><![CDATA[<p>Data manager is open source php library that allows developers to create CRUD admin panels of any complexity super fast! And no matter what CMS or framework you use or if you write custom code, all you need is:</p> PHP5 MySQL <p>Project Github page: <a href="https://github.com/andreytech/Data-manager">https://github.com/andreytech/Data-manager</a></p> <p>You can download library here: <a href="https://github.com/andreytech/Data-manager/zipball/master">https://github.com/andreytech/Data-manager/zipball/master</a></p> <p>Here are [...]]]></description>
			<content:encoded><![CDATA[<p>Data manager is open source php library that allows developers to create CRUD admin panels of any complexity super fast! And no matter what CMS or framework you use or if you write custom code, all you need is:</p>
<ul>
<li>PHP5</li>
<li>MySQL</li>
</ul>
<p>Project Github page: <a href="https://github.com/andreytech/Data-manager">https://github.com/andreytech/Data-manager</a></p>
<p>You can download library here: <a href="https://github.com/andreytech/Data-manager/zipball/master">https://github.com/andreytech/Data-manager/zipball/master</a></p>
<p>Here are some tutorials that will help you get started:</p>
<p><a href="/creating-php-crud-admin-panel-using-data-manager-library/">Creating php CRUD admin panel in 10 minutes using Data manager library</a><br />
<a href="/creating-crud-admin-panel-in-codeigniter/">Creating CRUD admin panel in Codeigniter using Data manager library</a><br />
<a href="/explaining-data-manager-field-parameters/">Detailed explanation of Data manager fields parameters</a></p>
]]></content:encoded>
			<wfw:commentRss>http://andreytech.com/what-is-data-manager/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Explaining Data manager field parameters</title>
		<link>http://andreytech.com/explaining-data-manager-field-parameters/</link>
		<comments>http://andreytech.com/explaining-data-manager-field-parameters/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 20:23:40 +0000</pubDate>
		<dc:creator>Andrey</dc:creator>
				<category><![CDATA[Data manager]]></category>

		<guid isPermaLink="false">http://andreytech.com/?p=55</guid>
		<description><![CDATA[<p>Here is explanation for most used parameters:<br /> name &#8211; for most fields( which doesn&#8217;t have &#8216;non_db&#8217; => 1 parameter) this parameter mean name of database table field which will be used to save information from this field.<br /> type &#8211; this is type of field that will be used. Most used field types are [...]]]></description>
			<content:encoded><![CDATA[<p>Here is explanation for most used parameters:<br />
<strong>name</strong> &#8211; for most fields( which doesn&#8217;t have &#8216;non_db&#8217; => 1 parameter) this parameter mean name of database table field which will be used to save information from this field.<br />
<strong>type</strong> &#8211; this is type of field that will be used. Most used field types are key, input, lookup, check, textarea, managing, list. For complete list of field types you can look at /data_manager/logic_fields.php file, I will also post tutorials for some of them in my blog.<br />
<strong>title</strong> &#8211; text title that will be used for displaying this field in admin panel.<br />
<strong>css_class</strong> &#8211; is used by some fields to define css class of an html object that is associated with field.<br />
<strong>list_mode</strong> &#8211; if set to 0, this field will not be shown when displaying list of items from database table ( first image ).<br />
<strong>single_mode</strong> &#8211; if set to 0, this field will not be shown when displaying single database table row information ( second image ).<br />
<strong>non_db</strong> &#8211; if set to 1, this field will not be associated with any field from database table and Data manager will not automatically save any information from this field. Also if non_db is set to 1, parameter &#8216;name&#8217; becomes useless.<br />
<strong>is_link</strong> &#8211; parameter can be used only by fields with types &#8216;input&#8217; and &#8216;lookup&#8217;. If set to 1, it text of field to a link that points to different page.<br />
<strong>link</strong> &#8211; parameter can be used only by fields with types &#8216;input&#8217; and &#8216;lookup&#8217;. It defines pattern for link that will point to page for editing a single row. Symbol star(*) is getting replaced by Data manager to a value of a field with &#8216;key&#8217; type from the same db table row, basically replaced with id of db table row.<br />
<strong>delete_link</strong> and <strong>edit_link</strong> &#8211; parameters can be used only by fields with &#8216;managing&#8217; type. Similar to &#8216;link&#8217; parameter, this parameters define patterns accordingly for deleting and editing of a single db table row.<br />
Parameters <strong>lookup_table</strong>, <strong>key_field</strong> and <strong>values_field</strong> can be used only by fields with &#8216;lookup&#8217; type. They are pretty much self explanatory, but I might write about them later.</p>
]]></content:encoded>
			<wfw:commentRss>http://andreytech.com/explaining-data-manager-field-parameters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating php CRUD admin panel in 10 minutes using Data manager library</title>
		<link>http://andreytech.com/creating-php-crud-admin-panel-using-data-manager-library/</link>
		<comments>http://andreytech.com/creating-php-crud-admin-panel-using-data-manager-library/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 12:56:35 +0000</pubDate>
		<dc:creator>Andrey</dc:creator>
				<category><![CDATA[Data manager]]></category>

		<guid isPermaLink="false">http://andreytech/?p=32</guid>
		<description><![CDATA[<p>If you are a php developer most likely you have ever had a task to create something like this:<br /> <a href="/wp-content/uploads/2011/12/employees_list.png"></a><br /> And when you click on one of item you need something like this to show up:<br /> <a href="/wp-content/uploads/2011/12/employee_info.png"></a><br /> And when you click &#8220;Save&#8221; or add new item, it will automatically [...]]]></description>
			<content:encoded><![CDATA[<p>If you are a php developer most likely you have ever had a task to create something like this:<br />
<a href="/wp-content/uploads/2011/12/employees_list.png"><img src="/wp-content/uploads/2011/12/employees_list.png" alt="Admin panel for managing employees" title="employees_list" width="590" class="alignnone size-full wp-image-46" /></a><br />
And when you click on one of item you need something like this to show up:<br />
<a href="/wp-content/uploads/2011/12/employee_info.png"><img class="alignnone size-full wp-image-40" title="employee_info" src="/wp-content/uploads/2011/12/employee_info.png" alt="Editing item in admin panel" width="347" height="327" /></a><br />
And when you click &#8220;Save&#8221; or add new item, it will automatically save all information to database.<br />
With <a href="/what-is-data-manager/">Data manager php library</a> you can easily create admin control panel like this for any table from your database in 10 minutes!<br />
And it doesn&#8217;t necessarily should be employees information. It can be anything &#8211; list of products, categories, orders, payments, ect. </p>
<h2>How it works?</h2>
<p>-First, you need to <a href="https://github.com/andreytech/Data-manager/zipball/master">download Data manager library</a>.<br />
-Put it anywhere on your server &#8211; it can be root or /libraries directory or any other.<br />
-Assign database connection information in /data_manager/params.php<br />
For example:</p>
<pre>
&lt;?php
define(&#039;DM_DB_HOST&#039;, &#039;localhost&#039;);
define(&#039;DM_DB_NAME&#039;, &#039;db_name&#039;);
define(&#039;DM_DB_USER&#039;, &#039;db_user&#039;);
define(&#039;DM_DB_PASS&#039;, &#039;db_user_pass&#039;);

define(&#039;DM_BASE_URL&#039;, &#039;http://mydomain.com/&#039;);
</pre>
<p>-Then you will need to create Data manager profile, which will tell Data manager what each field in you database table do.<br />
Create a file with a name of your profile with php extension ( for example &#8220;employees.php&#8221; ) inside /data_manager/profiles/ folder.<br />
Sample code for employees.php profile can look like this:</p>
<pre>
&lt;?php
$table = &#039;employees&#039;;

$fields = array (
	array (
		&#039;name&#039; =&gt; &#039;employeeNumber&#039;
		, &#039;type&#039; =&gt; &#039;key&#039;
		, &#039;title&#039; =&gt; &#039;ID&#039;
	)
	, array (
		&#039;name&#039; =&gt; &#039;firstName&#039;
		, &#039;type&#039; =&gt; &#039;input&#039;
		, &#039;title&#039; =&gt; &#039;First name&#039;
		, &#039;is_link&#039; =&gt; 1
		, &#039;link&#039; =&gt; &#039;/index.php?page=edit_employee&amp;id=*&#039;
	)
	, array (
		&#039;name&#039; =&gt; &#039;lastName&#039;
		, &#039;type&#039; =&gt; &#039;input&#039;
		, &#039;title&#039; =&gt; &#039;Last name&#039;
		, &#039;is_link&#039; =&gt; 1
		, &#039;link&#039; =&gt; &#039;/index.php?page=edit_employee&amp;id=*&#039;
	)
	, array (
		&#039;name&#039; =&gt; &#039;officeCode&#039;
		, &#039;type&#039; =&gt; &#039;lookup&#039;
		, &#039;title&#039; =&gt; &#039;Office&#039;
		//lookup field specific parameters
		, &#039;lookup_table&#039; =&gt; &#039;offices&#039;
		, &#039;key_field&#039; =&gt; &#039;officeCode&#039;
		, &#039;values_field&#039; =&gt; &#039;addressLine1&#039;
	)
	, array (
		&#039;name&#039; =&gt; &#039;email&#039;
		, &#039;type&#039; =&gt; &#039;input&#039;
		, &#039;title&#039; =&gt; &#039;E-mail&#039;
	)
	, array (
		&#039;name&#039; =&gt; &#039;is_contractor&#039;
		, &#039;type&#039; =&gt; &#039;check&#039;
		, &#039;title&#039; =&gt; &#039;Is contractor&#039;
	)
	, array (
		&#039;name&#039; =&gt; &#039;jobTitle&#039;
		, &#039;type&#039; =&gt; &#039;input&#039;
		, &#039;title&#039; =&gt; &#039;Job title&#039;
		, &#039;list_mode&#039; =&gt; 0
	)
	, array (
		&#039;name&#039; =&gt; &#039;managing&#039;
		, &#039;type&#039; =&gt; &#039;managing&#039;
		, &#039;title&#039; =&gt; &#039;Actions&#039;
		, &#039;delete_link&#039; =&gt; &#039;/index.php?page=delete_employee&amp;id=*&#039;
		, &#039;edit_link&#039; =&gt; &#039;/index.php?page=edit_employee&amp;id=*&#039;
		, &#039;non_db&#039; =&gt; 1
		, &#039;single_mode&#039; =&gt; 0
	)
);
</pre>
<p>Variable $table should be assigned to name of your database table that you need to create admin panel for.<br />
Variable $fields is an array of fields, that will be used to display data.<br />
As you can see each field have few mandatory parameters such as name, type and title. There are also other parameters that may be applied for fields of specific type or field of any type.<br />
You can also look at <a href="/explaining-data-manager-field-parameters/" target="_blank">detailed explanation of Data manager fields parameters</a>.</p>
<p>-In your php code you will need to include Data manager class file to use it, for example:</p>
<pre>
include_once $_SERVER["DOCUMENT_ROOT"].'/data_manager/DataManager.php';
</pre>
<p>-Next step is to add calls of proper Data manager functions inside your php code to make it work.<br />
For showing list of items from db table:</p>
<pre>
	$page = 1;
	$dm = new DataManager('employees');
	$dm->setItemsPerPage(7);
	$dm->setPage($page);
	$dm->setMode('list');
	$dm->setOrderingField('employeeNumber');
	if ($dm->loadData() === false) {
		var_dump($dm->getErrors());
		exit;
	}
	$titles = $dm->getTitles();
	$fields = $dm->getFields();
</pre>
<p>After executing this code variable $titles will contain array of titles of fields to display and variable $fields will contain array, each item of which will contain an html code for a field.<br />
Then you can use code similar to this to display table with list of db table rows.</p>
<pre>
&lt;table border=&quot;1&quot;&gt;

	&lt;tr&gt;
&lt;?php foreach($titles as $title) { ?&gt;
		&lt;td&gt;&lt;?php echo $title; ?&gt;&lt;/td&gt;
&lt;?php } ?&gt;
	&lt;/tr&gt;

&lt;?php foreach($fields as $row) { ?&gt;
	&lt;tr&gt;
&lt;?php 	foreach($row as $field) { ?&gt;
		&lt;td&gt;&lt;?php echo $field; ?&gt;&lt;/td&gt;
&lt;?php 	} ?&gt;
	&lt;/tr&gt;
&lt;?php } ?&gt;

&lt;/table&gt;
</pre>
<p>Then as follows, you can use this code for showing list of fields for editing or creating single db table row:</p>
<pre>
	$id = (int) (isset($_GET['id'])?$_GET['id']:0);
	$dm = new DataManager('employees');
	if ($id) {
		$dm->setKeyValue($id);
	}
	$dm->setMode('single');
	if ($dm->loadData() === false) {
		var_dump($dm->getErrors());
		exit;
	}
	$titles = $dm->getTitles();
	$fields = $dm->getFields();
	$fields = $fields[0];
</pre>
<p>As you can see, code is very similar, but this time we need to set &#8216;single&#8217; instead of &#8216;list&#8217; mode and assign db table id value to get proper row.<br />
Code for inserting/updating/deleting data is even easier:</p>
<pre>
	//inserting/updating row
	$data = $_POST;
	$dm = new DataManager('employees');
	if ($dm->save($data) === false) {
		var_dump($dm->getErrors());
		exit;
	}

	//deleting row
	$id = (int) (isset($_GET['id'])?$_GET['id']:0);
	$dm = new DataManager('employees');
	if ($dm->delete($id) === false) {
		var_dump($dm->getErrors());
		exit;
	}
</pre>
<p>On the internet you can find <a href="http://www.ourtuts.com/34-outstanding-admin-panels-for-your-web-applications/" target="_blank">some cool designs</a> for your admin panel and make it look better, Data manager will take care of the rest!<br />
Soon I will post more tutorials for advanced usage of Data manager and explanation of Data manager fields.<br />
So keep in touch!</p>
]]></content:encoded>
			<wfw:commentRss>http://andreytech.com/creating-php-crud-admin-panel-using-data-manager-library/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

