New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

ada/zf-assetic

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ada/zf-assetic

Source
Packagist
This package is abandoned and is no longer maintained.
The author recommends using true instead.
This version has been yanked by its maintainers and should not be used.
Version
dev-master
Version published
Total downloads
116
Maintainers
0
Created
Source

ZfAssetic

ZfAssetic is two ViewHelper that helps developper to integrate Assetic in Zend Framework views.

<?php
// In your view...
$this->cssAsset()->captureStart();
?>
<link rel="stylesheet" type="text/css" href="/media/css/styles.css" />
<link rel="stylesheet" type="text/css" href="/media/css/box.css" />
<?php
$this->cssAsset()->captureStart();
echo $this->cssAsset();
// Will output something like this :
// <link rel="stylesheet" type="text/css" href="/asset/0141522526d6be5302041ffa6093933b.css" />
?>

Install

  • Add the directory ZfAssetic to your include_path
  • Use a psr-0 compatible autoloader. Add the namespace "ZfAssetic" to your autoloader
  • Register the classes ZfAssetic_ViewHelper_CssAsset and ZfAssetic_ViewHelper_ScriptAsset in your view.

Configuration

To use these helpers, you have to create an Assetic AssetFactory that manages filters. The factory can then be added directly to the helper using the method setAssetFactory() or by setting the key AssetFactory to the Zend_Registry :

<?php
$factory = new Assetic\Factory\AssetFactory('/path/where/files/to/be/filtered/are');

$helper = new ZfAssetic_ViewHelper_CssAsset();

$helper->setAssetFactory($factory);
// Or...
Zend_Registry::set('AssetFactory', $factory);

Also, you have to set the path where to put the generated asset and the path where your webserver is configured to serve files :

<?php

$helper = new ZfAssetic_ViewHelper_CssAsset();

$public_dir = "/var/www";
$asset_dir = "/var/www/assets";

$helper->setPublicDirectory($public_dir);
$helper->setAssetDirectory($asset_dir);

FAQs

Package last updated on 01 Feb 2013

Related posts