rewriterule

— .htaccess
RewriteEngine On

RewriteCond %{HTTP_HOST} ^(.*)\.html\.local$
RewriteRule ^$ /index.php?id=%1 [L]
# (.*) == variable %1
# [L] flag last, apply condition to here

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://html.local/index.php?id=$1 [L]
# server variable == $1 $2 …

— index.php

If url is
http://admin.html.local
::result
admin

If url is
http://tester.html.local
::result
tester

If url is
http://admin.html.local/aaa
::result
aaa

Advertisements

invalid label

AJAX invalid label error in Firebug
public function ajaxdeleteAction() {
if ($this->_request->isXmlHttpRequest()) {
//delete comment
$comment_id = $this->_getParam(‘id’);
$comment = Doctrine::getTable(‘Comment’)->find($comment_id);
//$comment->delete();

$json[‘status’] = ‘success’;
echo ‘{“status”:”success”}’;
//$this->_helper->json($json);
exit;
}
}

Error :invalid label

—————————————
Solution
put json in round bracket ()
echo ‘({“status”:”success”})’;

Doctrine self relation YAML

Product:
tableName: product
columns:
id:
type: integer(4)
primary: true
autoincrement: true
parent_id:
type: integer(4)
name:
type: string(255)
price:
type: float(10)
description:
type: string()
relations:
Accessories:
type: many
class: Product
local: id
foreign: parent_id

$product = Doctrine::getTable(‘Product’)->find(1);

var_dump($product->id);
var_dump($product->Accessories->toArray());