EllisLab text mark
Advanced Search
3 of 14
3
   
Carabiner 1.4: Asset Management Library
Posted: 24 July 2009 03:16 PM   [ # 41 ]   [ Rating: 0 ]
Joined: 2008-06-27
120 posts

I really have no idea.  It must have been a config prob—I’m a noob…

Is it common for servers to disable URL file-access?

 
Posted: 24 July 2009 07:04 PM   [ # 42 ]   [ Rating: 0 ]
Joined: 2008-06-27
120 posts

Shoot, I lied.

It’s loading jquery…but any of my custom scripts won’t load.

I’ve tried using the display operator and the js operator in both my controller and HTML <head>...

I’m terribly frustrated.

 
Posted: 24 July 2009 07:23 PM   [ # 43 ]   [ Rating: 0 ]
Avatar
Joined: 2009-01-21
109 posts

What is your log level set at?  If you set it high (3 or 4), you should get a fairly good idea of what the problem might be.  Feel free to paste the logs from a request, and I can take a look.

You can message me directly, if you’d like.

 Signature 

Do you use CSS or JavaScript? Carabiner makes your life easier.  I promise.

CI-Disqus makes playing with the Disqus API a snap.

 
Posted: 24 July 2009 10:43 PM   [ # 44 ]   [ Rating: 0 ]
Avatar
Joined: 2008-05-04
166 posts

Hey Tony,

I actually have a question that ties to Carabiner that you may or may not be able to answer.

I currently make use of Coda for an IDE. If you’re familiar with Coda it allows for easy publishing of new files to a live/production site. I was wondering if you know of some way via Codeigniter or otherwise that I can set a switch which is automatically flipped when the Carabiner file hits the live site?

That way we would not have to change the BOOLEAN flag within Carabiner’s setup file that states whether we are in a DEV environment or a Prod environment.

More like a nice to have rather than a requirement….

Ohhh yeah and again, Carabiner is the shizzle! grin

 Signature 

Reality Knights - Have more fun

 
Posted: 25 July 2009 03:01 PM   [ # 45 ]   [ Rating: 0 ]
Avatar
Joined: 2009-01-21
109 posts

@dnyce Off the top of my head, I’m thinking you could do something like this:

$dev = ($_SERVER['SERVER_NAME'== 'localhost') ? TRUE FALSE

In my case (local MAMP install on OSX), the $_SERVER[‘SERVER_NAME’] var returns ‘localhost’.  From what I can tell, that should be pretty standard value if your developing locally, but I can’t say for sure.  If that particular server var isn’t set, I would check some of the others.

If that syntax looks weird, check out the php.net page on the ternary operator.  But, all I’m doing is setting a variable to true or false based on the value of $_SERVER[‘SERVER_NAME’].  You’d obviously still need to pass that value into the config method for Carabiner.

I hope that helps.

 Signature 

Do you use CSS or JavaScript? Carabiner makes your life easier.  I promise.

CI-Disqus makes playing with the Disqus API a snap.

 
Posted: 25 July 2009 09:30 PM   [ # 46 ]   [ Rating: 0 ]
Avatar
Joined: 2008-05-04
166 posts

Great!

I’ll try that out. I have the exact same setup so I believe it should work like a charm.

 Signature 

Reality Knights - Have more fun

 
Posted: 30 July 2009 02:32 PM   [ # 47 ]   [ Rating: 0 ]
Joined: 2009-03-08
13 posts

Hi Tony,

I’m trying out your library as well, and I’m experiencing the same issues as k.brown:

“URL file-access is disabled in the server configuration” -> this is because my host disabled the allow_url_fopen parameter for security reasons.

Each time you use the ‘file_get_contents’ function for files on other domains (eg. jQuery from the google repository)
Apperently there’s a workaround for this using “curl” but I’m unable to get it working.

When I change $config[‘dev’] to FALSE, it’s working, but when it’s set to TRUE it’s not. I think this is because the files aren’t combined and minified then…

Could you please look into this?

THANKS!

 
Posted: 30 July 2009 05:20 PM   [ # 48 ]   [ Rating: 0 ]
Joined: 2009-07-14
3 posts

Hi there, I am not Tony, but I can probably help.

http://tutorials.securesignup.net/index.php?page=how-do-i-change-php-settings

You can use .htaccess file to change the php settings.

so it would be

php_value allow_url_fopen On 

or you can set those values inside the PHP file

ini_set('allow_url_fopen'1); 
or
ini_set('allow_url_fopen''On'); 

^ Not sure which one works.

Hope that helps,
ainstushar.

 
Posted: 30 July 2009 05:37 PM   [ # 49 ]   [ Rating: 0 ]
Joined: 2009-03-08
13 posts

Hi ainstushar,

I’ve tried your 3 suggestions but I had no luck…

I’ve looking a bit further into this and so far I changed this:

line 822: $file_data .=  file_get_contents( $r ) .”\n”;
is now this:
$ch = curl_init();
$timeout = 5;
curl_setopt ($ch, CURLOPT_URL, $r);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_data = curl_exec($ch);
curl_close($ch);
log_message(‘debug’, ‘TEST line 822: ‘.$r);

and line 851: $contents = file_get_contents( $ref );
is now this:
$ch = curl_init();
$timeout = 5;
curl_setopt ($ch, CURLOPT_URL, $ref);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$contents = curl_exec($ch);
curl_close($ch);
log_message(‘debug’, ‘TEST line 851: ‘.$ref);

This now works with files coming from another domain, but it no longer works with local files. Is someone more familiar with the curl function, and sees what I’m doing wrong?

Thanks in advance for your help!

—edit—

After thinking more over this, I think the better solution is to build in an IF-statement, and use the curl function only when the requested file is an URL. If it isn’t, it should come from the file system (unnecessary http-request is avoided as well) with the file_get_contents function.

I’ll look into this a bit further tomorrow if I find some time.
OR if you find it sooner, or have another solution, don’t hold back wink

 
Posted: 30 July 2009 07:06 PM   [ # 50 ]   [ Rating: 0 ]
Joined: 2009-03-08
13 posts

I couldn’t resist fiddling with it a bit more.

As far as I can tell the “javascript” part works.
I’ve tested it, and it works for me now. I did it with an additional if which checks if it’s an url from another domain, or if it’s coming from the filesystem, and use the according “get” function then.

I did not change the “styles” part (yet), as usually these are coming from the filesystem.
Perhaps, for the sake of consistency, you could make the changes as well.

The changed file is attached to this post so you can find out if it’s alright.
The changes are marked as comments with “start change” and “end change”

 
Posted: 30 July 2009 09:54 PM   [ # 51 ]   [ Rating: 0 ]
Avatar
Joined: 2009-01-21
109 posts

It looks like you have this figured out.  I will add cURL support to my list of changes for the next version.  Great find!

 Signature 

Do you use CSS or JavaScript? Carabiner makes your life easier.  I promise.

CI-Disqus makes playing with the Disqus API a snap.

 
Posted: 31 July 2009 07:56 AM   [ # 52 ]   [ Rating: 0 ]
Joined: 2009-03-08
13 posts

Yes,

thanks.

Another thing I cannot figure out:

I use to put all my CSS files between the head tags, and put all my javascript files just before the closing body tag. (this is best practice for performance; see -> http://developer.yahoo.com/performance/rules.html)

When using groups in carabiner, I cannot see a way to do this. Is this possible?

 
Posted: 31 July 2009 08:41 AM   [ # 53 ]   [ Rating: 0 ]
Avatar
Joined: 2009-01-21
109 posts

If you’ve only got JS files defined in a group, then displaying that group will only show JS files.  If, however, you’ve defined both CSS and JS in a group, there is currently no way to de as you’ve asked.  I will add support for that in the display function in the next version.  In the meantime, I would split your group by asset type.  Meaning, if you had

$this->carabiner->display('groupname'); 

before, change your groupings and group names to be something like

$this->carabiner->display('groupname-js');[
$this
->carabiner->display('groupname-css'); 

In terms of adding support for this in the future, my thought would be to add the option for a second parameter to the display function for asset type, and let that filter what is displayed.  For example:

$this->carabiner->display('groupname','js'); 

Do you think that solution makes sense for the problem you’ve described?

 Signature 

Do you use CSS or JavaScript? Carabiner makes your life easier.  I promise.

CI-Disqus makes playing with the Disqus API a snap.

 
Posted: 31 July 2009 08:47 AM   [ # 54 ]   [ Rating: 0 ]
Joined: 2009-03-08
13 posts

Yes, that would solve it definately!

Can’t wait until your next version is released.
Will the “return as string” functionality for the display function be included in the next version as well?

Is there any way to be informed when another version is ready, or should I check the wiki once in a while?

 
Posted: 31 July 2009 08:51 AM   [ # 55 ]   [ Rating: 0 ]
Avatar
Joined: 2009-01-21
109 posts

Return as string will be included.  The best way to keep informed would be to stay notified about this thread changing.  Whenever I release a new version, I add a reply to the previous versions thread announcing it and linking to the new forum post.

 Signature 

Do you use CSS or JavaScript? Carabiner makes your life easier.  I promise.

CI-Disqus makes playing with the Disqus API a snap.

 
3 of 14
3