Welcome Guest, Not a member yet? Register   Sign In
Carabiner 1.4: Asset Management Library

[eluser]tonydewan[/eluser]
Interesting point. Are you calling the display() method without any parameters? You could probably do $this->carabiner->display('css'); and $this->carabiner->display('js'); and load them wherever and whenever you want.

[eluser]msteudel[/eluser]
Yeah I was loading without any params. I'll try loading the groups individually first ...

[eluser]Maglok[/eluser]
Greetings,

I am trying to work this library. So far it is promising, but I am having a problem. It seems to use the full FCPATH with index.php attached, while it needs to not use that. I saw some references to that in this thread, but most say it is fixed in 1.45.

I have DLed 1.45 though, from the start.

So it outputs this: /home/content/85/5336885/html/test/index.php
While it should use: /home/content/85/5336885/html/test/

My setup vars are simple:
js: scripts/
css: css/
cache: cache/

So I end with this as a url: /home/content/85/5336885/html/test/index.phpcache

That doesn't work. Smile

I am quite unfamiliar with FCPATH to begin with, so where am I going wrong?

[eluser]pickupman[/eluser]
FCPATH in defined in index.php. You can check to see if you have edited anything from there. Here's what mine looks like:
Code:
// Path to the front controller (this file)
    define('FCPATH', str_replace(SELF, '', __FILE__));
    
    // Name of the "system folder"
    define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));        


    // The path to the "application" folder
    if (is_dir($application_folder))
    {
        define('APPPATH', $application_folder.'/');
    }

[eluser]Maglok[/eluser]
According to my index.php

Code:
/*
|---------------------------------------------------------------
| DEFINE APPLICATION CONSTANTS
|---------------------------------------------------------------
|
| EXT        - The file extension.  Typically ".php"
| FCPATH    - The full server path to THIS file
| SELF        - The name of THIS file (typically "index.php")
| BASEPATH    - The full server path to the "system" folder
| APPPATH    - The full server path to the "application" folder
|
*/
define('EXT', '.'.pathinfo(__FILE__, PATHINFO_EXTENSION));
define('FCPATH', __FILE__);
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
define('BASEPATH', $system_folder.'/');

The comment is saying the full server PATH to this file. That seems to suggest it includes index.php. If that is so though, isn't the code in Carabiner (it uses FCPATH) 'wrong'?

[eluser]pickupman[/eluser]
You will notice my FCPATH does a string replace for the file path and index.php. I am now on 2.0, but the same defines should work for you.

[eluser]Maglok[/eluser]
I am on 1.7.2.

I looked through this thread again. Isn't it 'cheaper' on the cpu to just do dirname(FCPATH) or use __DIR__ (PHP 5.3)?

I don't really wanna edit the FCPATH, because you never know where else it is used. I also read back in this thread and you yourself seem to have posted that FCPATH does not work indeed. The strange thing though is that if it doesn't work, why has no one said so for over half a year?

It actually seems like dirname(FCPATH) was used first and then changed to FCPATH later. Yet __FILE__ (which FCPATH is derived from) includes the filename, and that should not happen. I don't get it. Why is FCPATH being used then?

[eluser]pickupman[/eluser]
I was on 1.7.2 when I posted the snippet with the same error as you. You can change FCPATH definition. Searching the source, it is only referenced in system/libraries/URI.php @line 149. Shouldn't break anything. Or just add the snippet I posted into your carabiner.php file to check and strip it.

Profile your code, and see which way is fastest. Running my preg_match every time maybe more overhead than editing FCPATH correctly, or using dirname().

[eluser]Maglok[/eluser]
Thanks for the info. I have changed my carabiner a bit for now:

Code:
$this->script_path = dirname(FCPATH). '/' .$this->script_dir;
        $this->script_uri = $this->base_uri.$this->script_dir;
        
        $this->style_path = dirname(FCPATH). '/' .$this->style_dir;
        $this->style_uri = $this->base_uri.$this->style_dir;

        $this->cache_path = dirname(FCPATH). '/' .$this->cache_dir;
        $this->cache_uri = $this->base_uri.$this->cache_dir;

The only thing I still have is that it required you to edit it, yet it has been downloaded near 900 times. I must be doing something strange or everyone has edited the code like this (or something similar). Smile

[eluser]pickupman[/eluser]
[quote author="Maglok" date="1290630106"]Thanks for the info. I have changed my carabiner a bit for now:
The only thing I still have is that it required you to edit it, yet it has been downloaded near 900 times. I must be doing something strange or everyone has edited the code like this (or something similar). Smile[/quote]

Agreed. That's one of the good/bad things about open source and free help. Sometimes you have to take matters into your own hands. That's why it would be nice for the author up this to github/bitbucket to allow community development. The wiki here seems to get stale as development of these projects move forward.

Hopefully most users are onto 2.0dev as it is stable enough to run live sites on, and easy to upgrade from 1.7.2. All of the EllisLab projects are using 2.0. This bug doesn't exists, as the defines have been updated.




Theme © iAndrew 2016 - Forum software by © MyBB