<?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>Vincent Reniers &#187; Nexis</title>
	<atom:link href="http://blog.vincentr.be/tag/nexis/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.vincentr.be</link>
	<description>From PHP Guru to Designer!</description>
	<lastBuildDate>Fri, 02 Jul 2010 17:59:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Nexis version 0.7</title>
		<link>http://blog.vincentr.be/2010/01/15/nexis-version-0-7/</link>
		<comments>http://blog.vincentr.be/2010/01/15/nexis-version-0-7/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 22:52:33 +0000</pubDate>
		<dc:creator>Vincent</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[Nexis]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.vincentr.be/?p=260</guid>
		<description><![CDATA[For the past few months, I&#8217;ve continued my work at my content management system. Since the start of the project in April 2009 the software has achieved quite some structure and features. All this with one goal in mind, to make things easier while developing websites. At this point, there only needs some minor functions [...]]]></description>
			<content:encoded><![CDATA[<p>For the past few months, I&#8217;ve continued my work at my content management system. Since the start of the project in April 2009 the software has achieved quite some structure and features. All this with one goal in mind, to make things easier while developing websites. At this point, there only needs some minor functions to be added to the system such as ACL (Access Control List) and more advanced language support. When it comes to performance tweaks I&#8217;ve tried to minimize the loops and queries, and with only about 10 000 to 12 000 lines of PHP I&#8217;d say this CMS is quite lightweight. Also to maintain optimal performance for more high-traffic website I&#8217;m still thinking about improving the cache. Now to decide wether this is the CMS you want to use for your site you would of course want to have a look at it&#8217;s features. I&#8217;ll try to give a good overview but I might add some new features later on because I could have forgotten about some.</p>
<h2>Structure</h2>
<p><img class="alignright" title="CMS Structure" src="http://vincentr.be/temp/images/structure-cms.gif" alt="" />The aspect is the structure of the CMS, it&#8217;s not Module-View-Controller based but it&#8217;s something different. There are 8 different directories, but you will only use a few of them most of the time: <strong>admin</strong>, <strong>lang</strong>, <strong>cache</strong>, <strong>images</strong>, <strong>css</strong>, <strong>templates</strong>, <strong>modules </strong>and <strong>system</strong>. The first directory contains the <strong>admin </strong>area, it is expandable but you can do this within your module so there isn&#8217;t much need to go in there. Then we have the <strong>lang </strong>and <strong>cache</strong> directories. These are maintained by the system and store system files. The <strong>images </strong>and <strong>css </strong>directories are just shared directories to be used amongst different templates e.g. error css. I might move that to one single html folder. The <strong>system </strong>directory contains functions, classes, configuration, imports, the router and database class. Only some of these files are imported by default because they are necessary to operate succesfully. Setting up your template is very easy. It doesn&#8217;t require a lot of changes, you just place some {TAGS} such as {MODULE} and {TITLE} which are automaticly filled in.</p>
<p>The module tag is controlled by the <strong>modules</strong>, these form the core of your application. They load the HTML files necessary to generate the content for the pages. The PHP and HTML is seperated from eachother by my own template engine. An example of a module could be <strong>news</strong>. This module will have an <strong>html</strong>, maybe <strong>xml </strong>(for ajax and rss feeds) directories. And a<strong> control.php file</strong>. I will go into this more deeply later on since there are also <strong>two different types</strong> of modules: background processes and display modules. Only one display module can be called at a time and the various background processes may run but these are often very simple such as a log to keep record of users. Now what a display module does is, when an action is called the php will process it. It will import the HTML file and put it on the {MODULE} tag and the html file may also contain its own user-defined tags which may be used to put php variables into or to place another html file. PHP can only be used in the html when it is written with a .phtml extension. The template engine will parse this file when it recognises this extension. So this makes a very clear distinction between PHP and HTML while giving the programmer the freedom of still beeing able to use PHP in the HTML if needed. There is no need to learn a custom template language.</p>
<h2>Features</h2>
<p>Now that you have a basic overview of the structure a good overview of features may be handy.</p>
<ul>
<li>Templates: seperate PHP from HTML</li>
<li>Support for multiple languages</li>
<li>Router for when you have mod_rewrite enabled, but this is not necessary</li>
<li>Advanced Caching</li>
<li>URL and Parameter validation on top-level.</li>
<li>Custom Error Handling</li>
<li>Database class for MySQL</li>
<li>Security for MySQL Injections</li>
<li>Admin area</li>
<li>User management</li>
<li>Access Control List</li>
<li>RSS Feed Generator</li>
<li>Support for AJAX Requests</li>
<li>Custom Template Engine</li>
<li>Extensions for Admin Area</li>
<li>Multiple templates (public and private)</li>
</ul>
<p>I&#8217;m sure I have forgotten about some functions, but these are the main functions that the system offers you =). Now wether I will make it openSource is still not sure.</p>
<h2>Example of a News Module</h2>
<p>Ok suppose we would like to create a module that serves news articles. We will create a directory &#8216;<strong>news</strong>&#8216; in modules. This module will contain a html folder with the <strong>HTML </strong>for the Article page and the HTML for each article.  So we create &#8216;<strong>news.html&#8217;</strong> and &#8216;<strong>article.html</strong>&#8216;. Now in news module we will also create a &#8216;<strong>display.php</strong>&#8216; file that will handle the actions. So basically what we have got now should look like:</p>
<p><img class="alignleft" title="News Module" src="http://vincentr.be/temp/images/module-news.gif" alt="News Module" />First of all we will have to tell the system to allow the request. So we open up the <strong>router </strong>and add this line.</p>
<p>This will tell the Router to allow News and to only accept parameters from article with a numeric value. You can specify extra options for more advanced url and parameter validation but we won&#8217;t go into that right now.</p>
<pre class="brush: php;">Router::setURL('/News/article/*');  </pre>
<p>Now we will supply some <strong>HTML </strong>to work with. An example of what &#8216;<strong>news.html</strong>&#8216; could look like is:</p>
<pre class="brush: xml;">&lt;h1&gt;News Page&lt;/h1&gt;

&lt;div id=&quot;articles&quot;&gt;{ARTICLES}&lt;/div&gt;</pre>
<p>Second we will create the HTML for the &#8216;<strong>article.html</strong>&#8216;.</p>
<pre class="brush: xml;">&lt;div class=&quot;article-preview&quot;&gt;
&lt;h2&gt;{TITLE}&lt;/h2&gt;

&lt;p&gt;{CONTENT}&lt;/p&gt;

&lt;a href=&quot;/news/article/{ID}&quot;&gt;Read More&lt;/a&gt;
&lt;/div&gt;</pre>
<p>Ok enough HTML written! Time to make this code work =). We will now go into the &#8216;<strong>display.php</strong>&#8216;:</p>
<pre class="brush: php;">$db-&gt;setQuery('SELECT `title`, `content`, `id` FROM `@__news` LIMIT 5');
$db-&gt;fetchList('Articles');

$tpl-&gt;loadHTML('news', 'Module');

foreach($Articles as $Article){
$tpl-&gt;loadHTML($html = 'article', $tag = 'Articles', true);
$tpl-&gt;Replace($Article);
}

$tpl-&gt;Delete('Articles');</pre>
<p>Only a few lines to make the entire news article work! Now let me explain this line by line because it may seem complicated at first sight. First we load the articles from the database. The <strong>@__</strong> is needed if you wish to make use of a table prefix. The results are loaded into the variable $Articles. Then we load in the HTML file and place it where the <strong>{MODULE} </strong>tag is located. Now this makes the tags in &#8216;<strong>news.html</strong>&#8216; available for use to the template engine. And then it will go through each article one by one and while we do this we will load in &#8216;<strong>article.html</strong>&#8216; each time and replace the tags inside them. And finally we will have to delete the remaining<strong> {ARTICLES}</strong> tag because we have specified a third parameter true in the loadHTML function which puts the <strong>{ARTICLES}</strong> tag back in place for use. Making it available for the second article and so on.</p>
<p>The replace function may be unclear right now, but what it does is. It sees that $Article is an array and for each key it tries to find an according tag and then it puts the values of the key on the location of the tag.<br />
Another method to do this would have been:</p>
<pre class="brush: php;">$tpl-&gt;Replace( array( 'title' =&gt; $Article['title'], 'content' =&gt; $Article['content'] ) ); </pre>
<p>But the example is just to show what kind of magic into some functions =). I hope you have enjoyed reading through this quick introduction. I hope it may provide you with some insight it the possibilities of using a cms. The reason why I think this CMS might be interesting is because it isn&#8217;t really based on one model out there, it is more a unique combination of what I thought to be the best solution I encountered each time while programming this system.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vincentr.be/2010/01/15/nexis-version-0-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New website online!</title>
		<link>http://blog.vincentr.be/2009/11/07/new-website-online/</link>
		<comments>http://blog.vincentr.be/2009/11/07/new-website-online/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 13:08:21 +0000</pubDate>
		<dc:creator>Vincent</dc:creator>
				<category><![CDATA[My Website]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Nexis]]></category>
		<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://vincentr.be/?p=252</guid>
		<description><![CDATA[As you may have noticed, quite some changes have occurred lately on my site. The most important change is the move of the blog from the domain to the subdomain blog.vincentr.be. And instead there now is a good overview of my work on a portfolio. It also includes my latest tweets and blog posts to [...]]]></description>
			<content:encoded><![CDATA[<p>As you may have noticed, quite some changes have occurred lately on my site. The most important change is the move of the blog from the domain to the subdomain blog.vincentr.be. And instead there now is a good overview of my work on a portfolio. It also includes my latest tweets and blog posts to give a quick overview.</p>
<p>The portfolio is also the first website that goes live on my Nexis CMS ( Yes I renamed the cms from Nexus to Nexis ). On launch I experienced quite some problems. Most of them had to do with the include paths. Since I have set a  BASE path constant which is used in each require or include function. This constant wasn&#8217;t correct anymore, because of the fact that I&#8217;m on shared hosting and my path isn&#8217;t C:\\ anymore. That gave me quite some trouble, but I had everything solved in 1 hour. I also noticed some problems where my localhost should have given an error, but it seems to have ignored it or found a way to solve it.</p>
<p>Anyhow, let me know what you think of the new layout <img src='http://blog.vincentr.be/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vincentr.be/2009/11/07/new-website-online/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
