18 Sep 2014
BasicMVC is a library to create MVC
structure with Slim Framework. It uses Slim
framework router to reach the controllers.
In this text, I will try to help bootstraping a project with BasicMVC and Slim
Framework. First, let’s talk about the file structure. You can use what you want
in your structure. Because, in the BasicMCV, all the directories configurable.
In this structure, application directory will be
app/ directory and
APP_DIR. Your controllers will be at
and your models will be at
app/public/models/ etc. When you create your
BasicMVC object with index.php, you can set them like:
$basicmvc = new BasicMVC($app, array(
"controllers_path" => APP_DIR . "public/controllers/",
"models_path" => APP_DIR . "public/models/",
"library_path" => APP_DIR . "public/system/library/",
"template_constants" => array()
You must set your path of controllers, models and views.
template_constants is a variable to send data directly to view. I will use it
to send some constant of my project. For example, I define a
is base url of my project. I will send it to view and use it there.
I will use Twig Template Engine to render views.
View files are at
app/public/views/ folder. First, I will create twig object.
See example below.
$twigView = new \Slim\Views\Twig();
$app = new \Slim\Slim(
'mode' => 'development', // development, test, and production
'debug' => true,
'view' => $twigView,
'templates.path' => APP_DIR . "public/views/"
You can also use Smarty Template Engine as template
engine. See example below.
$view = new \Slim\Views\Smarty();
$view->parserDirectory = APP_DIR . "public/views/";
$view->parserCompileDirectory = APP_DIR . 'public/cache/';
$view->parserCacheDirectory = APP_DIR . 'public/cache/';
That’s all. You can ready to run your project. One more thing, I will explain
your controller, model and view file contents following days.
02 Sep 2014
By default, Zend Server 7.0.0 has MySQL 5.5. But there are lots of feature in MySQL 5.6.20. ANd i decide to upgrade MySQL to 5.5 to 5.6.20. First of all, i get a backup from PhpMyAdmin. This is very important. And shutdown all Zend Server with
sudo /usr/local/zend/bin/zendctl.sh stop
And i open
zendctl.sh file with nano and remove all mysql start and stop operation from there.
if $MYSQL_EN; then
if $MYSQL_EN; then
I save and close file. After that, start the Zend Server and check Activity Monitor for MySQL. MySQL was not started. I completely delete files from
Now, i install MySQL 5.6.20 from http://dev.mysql.com/downloads/mysql/. Select your platform and DMG Archive. After downloading, install it with next. The installation directory of MySQL is
/usr/loca/mysql. We are work in this directory. MySQL installer also includes a MySQL Preference Pane. You can start and stop your MySQL Server from MacOSx System Preferences Panel.
Now, we change the
my.cnf file for new mysql. I change it like this:
#password = your_password
port = 3306
socket = /tmp/mysql.sock
port = 3306
socket = /tmp/mysql.sock
key_buffer_size = 16K
max_allowed_packet = 1M
table_open_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 128K
After that, save the file and your can change every settings with the mysqladmin.
sudo mysqladmin status --socket=/tmp/mysql.sock -h 127.0.0.1 -P 3306 -u root -p
Then restart your MySQL Server. Now, we must change our php.ini file to connect from PHP. Your Zend Server php.ini file is
You must change the following lines :
Now, You can restart Zend Server and it is ready.
23 May 2014
h1. Example Post
p(meta). 23 May 2014 - Istanbul
This post is an example post to sampling the markdown grammer.
h2. An exhibit of Markdown
This note demonstrates some of what “Markdown”:markdown is capable of doing.
Note: Feel free to play with this page. Unlike regular notes, this doesn’t automatically save itself.
h2. Basic formatting
Paragraphs can be written like so. A paragraph is the basic block of Markdown. A paragraph is what text will turn into when there is no reason it should become anything else.
Paragraphs must be separated by a blank line. Basic formatting of italics and bold is supported. This can be nested like so.
h3. Ordered list
- Item 1
- A second item
- Number 3
Note: the fourth item uses the Unicode character for “Roman numeral four”:format.
h3. Unordered list
- An item
- Another item
- Yet another item
- And there’s more…
h2. Paragraph modifiers
h3. Code block
Code blocks are very useful for developers and other people who look at code or other things that are written in plain text. As you can see, it uses a fixed-width font.
You can also make
inline code to add code into other things.
quote. Here is a quote. What this is should be self explanatory. Quotes are automatically indented when they are used.
There are six levels of headings. They correspond with the six levels of HTML headings. You’ve probably noticed them already in the page. Each level down uses one more hash character.
h3. Headings can also contain formatting
h3. They can even contain
Of course, demonstrating what headings look like messes up the structure of the page.
I don’t recommend using more than three or four levels of headings here, because, when you’re smallest heading isn’t too small, and you’re largest heading isn’t too big, and you want each size up to look noticeably larger and more important, there there are only so many sizes that you can use.
URLs can be made in a handful of ways:
- A named link to “MarkItDown”:markitdown. The easiest way to do these is to select what you want to make a link and hit
- Another named link to MarkItDown
- Sometimes you just want a URL like http://www.markitdown.net/.
A horizontal rule is a line that goes across the middle of the page.
It’s sometimes handy for breaking things up.
Markdown can also contain images. I’ll need to add something here sometime.
There’s actually a lot more to Markdown than this. See the official “introduction”:basics and “syntax”:syntax for more information. However, be aware that this is not using the official implementation, and this might work subtly differently in some of the little things.