Howto setAssetLocation

2 views
Skip to first unread message

epsi nurwijayadi

unread,
Jun 27, 2009, 5:30:03 AM6/27/09
to Clientcide
Hello all JS coders.

I've read the thread 'Cannot link my external assets'but still got a
problem.
I think I am missing something foolish but I can't figure out what is
it.

So I struggled with view testing here with code below.
/var/www/n00b/test.php

All using date picker. Date picker shown so I assume clientcide and
moo works well.
[.. Great progress I love it ..]

But still the fancy window do not shown any border.
The border assets only shown in one of four attempt.
[.. One luck is better than none ..]

[OK] file:///var/www/n00b/test.html with http://localhost/n00b/assets
[XX] file:///var/www/n00b/test.html with /assets
[XX] http://localhost/n00b/test.html with http://localhost/n00b/assets
[XX] http://localhost/n00b/test.html with /assets

I'm not always with internet access,
sometimes only slow bandwith,
that's why I need local assets.

I'm totally clientcide n00b. ;-)
Any working solution or clue is helping.

TIA
~rizqi

ps. Apologize for straight word, I don't know how to express emotion
in English.
----------------------------------

<html>
<head>
<title>Test</title>
<script type="text/javascript" src="js/mootools-1.2.3-core-nc.js"></
script>
<script type="text/javascript" src="js/mootools-1.2.3.1-more.js"></
script>
<script type="text/javascript" src="js/clientcide-trunk-2.1.0.js"></
script>
<script type="text/javascript">
Clientcide.setAssetLocation('/assets');
// Clientcide.setAssetLocation("http://localhost/n00b/assets");
</script>
</head>

<body>
<script type="text/javascript">
//<![CDATA[
window.addEvent("domready",function(){
new DatePicker('dateExample', {
additionalShowLinks:['dateExampleImg'],
format: '%a, %b %d %Y'//Mon, Jan 01 2007
});
});
//]]>
</script>
From <input type="text" id="dateExample">
<img src="assets/datePicker/calendar.gif"
id="dateExampleImg" style="float: none; margin: 0px;">
</body>
</html>

Philip Thompson

unread,
Jun 27, 2009, 3:42:25 PM6/27/09
to clien...@googlegroups.com
On Jun 27, 2009, at 4:30 AM, epsi nurwijayadi wrote:

> Hello all JS coders.
>
> I've read the thread 'Cannot link my external assets'but still got a
> problem.
> I think I am missing something foolish but I can't figure out what is
> it.

--snip!--

> I'm totally clientcide n00b. ;-)
> Any working solution or clue is helping.
>
> TIA
> ~rizqi
>
> ps. Apologize for straight word, I don't know how to express emotion
> in English.
> ----------------------------------
>
> <html>
> <head>
> <title>Test</title>
> <script type="text/javascript" src="js/mootools-1.2.3-core-nc.js"></
> script>
> <script type="text/javascript" src="js/mootools-1.2.3.1-more.js"></
> script>
> <script type="text/javascript" src="js/clientcide-trunk-2.1.0.js"></
> script>
> <script type="text/javascript">
> Clientcide.setAssetLocation('/assets');
> // Clientcide.setAssetLocation("http://localhost/n00b/assets");
> </script>
> </head>

If your assets directory is located within the n00b directory, the
above line you have uncommented will not work. You would want:

Clientcide.setAssetLocation('assets/');

because assets is not in the root directory of the web server.
However, I also use the DatePicker, and I have "calendar.gif" in the
assets directory. In your case, you would want to put it...

assets/calendar.gif

instead of assets/datePicker/calendar.gif. Try moving that gif and see
if it shows up. Also, check out the "Net" tab in Firebug - it will
show you where it's trying to read files from and failing (in red).

Hope that helps...

~Philip

Aaron Newton

unread,
Jun 27, 2009, 4:30:49 PM6/27/09
to clien...@googlegroups.com
I need to update the assets directory a bit.

DatePicker no longer uses the calendar assets as it uses StickyWin.UI for it's background and whatnot. To use the assets just drop the entire assets directory somewhere on your server (let's say you put it at /art/clientcide/assets). Then do:

Clientcide.setAssetLocation('/art/clientcide/assets/');

And you should be set.

epsi nurwijayadi

unread,
Jun 27, 2009, 5:10:52 PM6/27/09
to Clientcide
Cheers Philip Thompson.

Wow... fast answer. Now it works well.
The idea of using "Net" tab in firebug is really helpful.

test.html:
Clientcide.setAssetLocation('/n00b/assets');

joomla::behavior.php:
$assetInit = 'Clientcide.setAssetLocation("'.JURI::root(true).'/media/
assets");';
$document->addScriptDeclaration($assetInit);

Thank you so much for the clue, I remind.

~rizqi
ps. I lookup thefreedictionary.com for the word snip. Now I
understand. It means cut. ;-)

Philip Thompson

unread,
Jun 28, 2009, 9:31:15 PM6/28/09
to clien...@googlegroups.com

Glad I could help a little. Take note of Aaron's previous email -
that's also a good tip. ;)

~Philip

Reply all
Reply to author
Forward
0 new messages