====== Hacks and Tips ======
* [[tips:solar_in_subdir|How to run Solar in a subdiretory]]
* [[tips:solarified_classes|How to create "Solarified" classes]]
* [[tips:subversion|Subversion Tips]]
===== Set Database Charset =====
A little piece of code is needed to let PDO know which MySQL character set you are using, right after it connects to the database. You just have to extend Solar_Sql_Adapter_Mysql and exec a "SET CHARACTER SET" after connection, and then use your custom adapter instead. When you add a charset to your adapter config, it will be correctly set.
_config['charset'])) {
$this->_pdo->exec('SET CHARACTER SET ' . $this->_config['charset']);
}
}
}
?>
===== .htaccess file to remove the hm.... ugly index.php prefix =====
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^/index\.php/.*$
RewriteCond %{REQUEST_URI} !^/public/.*$
RewriteRule ^(.*)$ index\.php/$1 [QSA,L]
===== A way to link to different vendors public resources =====
In Solar you make a symlink from your vendor dir's public directory to your www-root so that you can link to public recources like images and css files. Creating URLs to those resources is not a problem when you use Solar view helpers such as Solar_View_Helper_Image because Solar is aware of the 'public' dir's location. However, what if you want to link to resources in one vendors public dir to another vendors public dir? Just use relative paths with prefixing every url with a '../../'. This will tell the browser to go and fetch a resource from the root of the public dir.
Say you would like to use stripes.jpg as a background image in Vendor2's CSS file main.css. Directory structure would be:
public/
Vendor/
styles/
main.css
images/
stripes.jpg
Vendor2/
styles/
main.css
the css markup would be something like:
div.my-div {
background-image: url(../../Vendor/images/stripes.jpg);
}
This will always find the resource as long as you structure your public dir by vendor.