- A very simple tutorial to start with. Intro to git for web designers
- Git for the lazy
- Intro to github
- Pro Git
- Git Ready
- Think Like (a) Git
- Help.Github
This is just a quick response to http://me.veekun.com/blog/2012/07/28/quick-doesnt-mean-dirty/. I won't bother to write a proper blog post for this, so a Gist will have to do ;)
When I read that article, one thing really striked me: If you want to quickly create a web app in PHP, you do exactly the same. I mean, exactly.
I never used the Silex microframework before, so I took this as a chance to see how it works. I'll just do the same as eevee did, only with a bit less commentary (this is a Gist after all!)
I hope that this will show you that PHP and Python are really similar to work with. Also this should show that just because you're using PHP, doesn't mean that you write dirty code. The similarity in the process and code is really incredible :)
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-s | |
RewriteRule ^(.*)$ rest/index.php?_rest=$1 [QSA,NC,L] | |
RewriteCond %{REQUEST_FILENAME} -d | |
RewriteRule ^(.*)$ rest/index.php [QSA,NC,L] | |
</IfModule> |
<?php | |
$siteName = $modx->getOption('siteName', $scriptProperties, $modx->getOption('site_name')); // Имя сайта | |
$companyName = $modx->getOption('companyName', $scriptProperties, $modx->getOption('site_name')); // Компания | |
$bid = $modx->getOption('bid', $scriptProperties, 10); // Цена за клик | |
$categoriesTpl = $modx->getOption('minishop.categories_tpl'); // Шаблоны категорий | |
$goodsTpl = $modx->getOption('minishop.goods_tpl'); // Шаблоны товаров | |
$siteUrl = $modx->makeUrl($modx->getOption('site_start'), '', '', 'full'); // Ссылка на главную страницу сайта | |
$descTpl = strip_tags($modx->getOption('descTpl', $scriptProperties, '[[+description]]')); // Шаблон для описания товара, без html | |
// Параметры товаров |
<?php | |
/** | |
* ========================= | |
* defaultTemplateByParentTv | |
* ========================= | |
* | |
* Plugin for modX Revolution | |
* Set default template for children of a ressource | |
* | |
* Author: |
[[[[*page-image:notempty=`$wrapImgThumb? &src=`*page-image` &alt=`[[*pagetitle]]` &thumbOpts=`w=480&h=320``]]]] |
Snippet: [[SnippetName]] | |
Chunk: [[$ChunkName]] | |
System Setting: [[++SettingName]] | |
TV: [[*fieldName/TvName]] | |
Link tag: [[~PageId? ¶mName=`value`]] | |
Placeholder: [[+PlaceholderName]] | |
<?php |
<?php | |
/* LangRouter | |
* ========== | |
* | |
* This plugin is meant to be used with Babel extra for MODX Revolution. It | |
* takes care of switching contexts, which hold translations, depending on URL | |
* requested by client. LangRouter works with so called subfolder based setup, | |
* in which many languages are served under a single domain but are | |
* differentiated by a virtual subfolder indicating the language, eg. | |
* mydomain.com/pl/. |
Snippet: [[SnippetName]] | |
Chunk: [[$ChunkName]] | |
System Setting: [[++SettingName]] | |
TV: [[*fieldName/TvName]] | |
Link tag: [[~PageId? ¶mName=`value`]] | |
Placeholder: [[+PlaceholderName]] | |
<?php |
<?php | |
// Вывод ошибок | |
ini_set('display_errors', 1); | |
ini_set('memory_limit', '512M'); | |
error_reporting(E_ERROR); | |
// Подключаем | |
define('MODX_API_MODE', true); | |
require dirname(dirname(dirname(__FILE__))).'/index.php'; |