2017 © Pedro Peláez
 

yima-core-module yima-static-uri-helper

View Helper to define configurable and on-demand statics uri to loading file assets or generating dynamic links.

image

rayamedia/yima-static-uri-helper

View Helper to define configurable and on-demand statics uri to loading file assets or generating dynamic links.

  • Sunday, June 21, 2015
  • by Payam
  • Repository
  • 1 Watchers
  • 1 Stars
  • 12 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Static Uri Helper Module

this module is part of Yima Application Framework, (*1)

Why this module?

Configurable Statics Assets

Modules that need some assets can use a key for asset and url for source. php /* * Set from merged config */ return array( 'statics.uri' => array( 'Twitter.Bootstrap' => '//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.0/js/bootstrap.min.js', ), // ... ); ```php /* * Set from any where that we can get helper object */ $staticsUri = $this->staticsUri('self'); // from within view you can get self object like this $staticsUri->setPath('Key.Of.Uri', 'uri/path/to/target');, (*2)

```, (*3)

Stored Key Path

```php echo $this->staticsUri('Twitter.Bootstrap'); // output: //cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.0/js/bootstrap.min.js, (*4)

```, (*5)

Default Stored Key Path

```php echo $this->staticsUri('basepath'); // output in exp.: /app_dir echo $this->staticsUri('serverurl'); // output in exp.: http://raya-media.com/, (*6)

```, (*7)

Generate Dynamic Uri

```php $this->staticsUri('self') ->setPath('ondemand.rayamedia.server', '$protocol://raya-media.com');, (*8)

echo $this->staticsUri('ondemand/rayamedia/server', array('protocol' => 'http')); // output: http://raya-media.com, (*9)

```, (*10)

Generate Dynamic Uri With Default Values

$basepath and $serverurl are default values., (*11)

```php $siteUser = 'payam'; $this->staticsUri('self') ->setVariable('user', $siteUser); // register default variable, (*12)

// this uri not registered path // we also can use this for registered path echo $this->staticsUri( '$basepath/www/$user/some/$folder', array('folder' => 'media') ); // output: /app_dir/www/payam/some/media, (*13)

echo $this->staticsUri( '$basepath/www/$user/some/$folder', array('basepath' => '/alterpath', 'folder' => 'media') ); // output: /alterpath/www/payam/some/media, (*14)

/* Pass variables by order * in this format helper don't support default variables */ echo $this->staticsUri( '$var1/www/$var2/some/$var3', '/alterpath', $user, $media ); // output: /alterpath/www/payam/some/media, (*15)

```, (*16)

Installation

Composer installation:, (*17)

require rayamedia/yima-static-uri-helper in your composer.json, (*18)

Or clone to modules folder, (*19)

Enable module in application config, (*20)

Support

To report bugs or request features, please visit the Issue Tracker., (*21)

Please feel free to contribute with new issues, requests and code fixes or new features., (*22)

The Versions

21/06 2015

dev-master

9999999-dev

View Helper to define configurable and on-demand statics uri to loading file assets or generating dynamic links.

  Sources   Download

The Requires

 

by Payam Naderi

zf2 assets zf2 module raya media yima statics