Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Global Url Service #1532

Closed
ovr opened this issue Nov 7, 2013 · 3 comments
Closed

[BUG] Global Url Service #1532

ovr opened this issue Nov 7, 2013 · 3 comments

Comments

@ovr
Copy link
Contributor

ovr commented Nov 7, 2013

Hi all ^^

$this->assets
    ->collection('vendors')

    ->addJs('js/jquery-2.0.2.min.js')
    ->addJs('js/bootstrap.min.js')
    ->addJs('js/underscore-min.js')
    ->addJs('js/backbone-min.js')
    ->addJs('js/jquery.form.min.js')
    ->addJs('src/lib/ns.js')

    ->join(true)
    ->addFilter(new Phalcon\Assets\Filters\Jsmin())

    ->setTargetPath(APPLICATION_PATH . '/../public/js/vendors.js')
    ->setPrefix(\Uniqhand\Core::getSubDomainMainUrl('s'))
    ->setTargetUri('js/vendors.js');

Output

    <script type="text/javascript" src="///s.handmade.ru/js/vendors.js"></script>

It currently didnt work in old opera versions http://gyazo.com/6828afda5351d5fef6cd64ad481e9d3c Assets use Phalcon\\Tag for create tag. why it didnt use DI? In My Di tag class is \Uniqhand\Helpers
In phalcon tag javascriptInclude and stylesheetInclude use PHP_METHOD(Phalcon_Mvc_Url, getStatic)
this allways concat _staticBaseUri = / + url but my url is //u.handmade.ru/js/vendors.js and output /// 3 slashes
I say about this 3 times but no one fix it and say see dock setPrefix.
Please anyone help with this

@ovr
Copy link
Contributor Author

ovr commented Nov 7, 2013

#1157
#1324
But this bug is global with all urls generated by Phalcon

@dreamsxin
Copy link
Contributor

Joined resources are always local.
Consider increasing function setTargetLocal, i test finsh it.

    public function testIssue1532()
    {
        @unlink(__DIR__ . '/assets/production/1532.js');
        $di = new \Phalcon\DI\FactoryDefault();
        $assets = new \Phalcon\Assets\Manager();
        $assets->useImplicitOutput(false);
        $assets->collection('js')
            ->addJs('unit-tests/assets/jquery.js')
            ->join(true)
            ->addFilter(new Phalcon\Assets\Filters\Jsmin())
            ->setTargetPath(__DIR__ .'/assets/production/1532.js')
            ->setTargetLocal(FALSE)
            ->setPrefix('//phalconphp.com/')
            ->setTargetUri('js/jquery.js');

        $this->assertEquals($assets->outputJs('js'), '<script type="text/javascript" src="//phalconphp.com/js/jquery.js"></script>' . PHP_EOL);
    }

phalcon pushed a commit that referenced this issue Nov 25, 2013
Fix #1532 Add Phalcon\Assets\Collection::setTargetLocal
@ovr
Copy link
Contributor Author

ovr commented Dec 4, 2013

It works, thx @dreamsxin

@ovr ovr closed this as completed Dec 4, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants