[wp-hackers] howto including full path in javascript file.

tunamaxx at yahoo.com tunamaxx at yahoo.com
Mon Feb 8 18:43:58 UTC 2010


I think the OP was asking how to use the full path INSIDE javascripts, not how to include them in themes. 

I'd like to know how to do this as well. Could you create a var in a script in the head that contained the path as instructed by Mitch, and then use the value of that var in the included script?

Thanks,

Tony
 
------Original Message------
From: Mitch Canter | studionashvegas
Sender: wp-hackers-bounces at lists.automattic.com
To: wp-hackers at lists.automattic.com
ReplyTo: wp-hackers at lists.automattic.com
Subject: Re: [wp-hackers] howto including full path in javascript file.
Sent: Feb 8, 2010 9:57 AM

One of two options works - if you are keeping the javascript files in your
root directory, prepend the urls with <?php bloginfo('siteurl'); ?>.  If
you're doing it only within your template, use <?php
bloginfo('template_directory'); ?>

Example:

src="<?php bloginfo('siteurl'); ?>/js/thickbox.js"

or

<img src="<?php bloginfo('siteurl'); ?>/js/img/thickbox.jpg">

Good for linking to images too.

-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Bjorn Wijers
Sent: Monday, February 08, 2010 11:46 AM
To: wp-hackers at lists.automattic.com
Subject: [wp-hackers] howto including full path in javascript file.

Hi,

I was wondering what other people use to include full paths in their
theme javascript files and keep it dynamic (so no hardcoded paths!). For
instance I would like to call some images in my javascript file and I
need to use a full path. What would be the best practice for this?

Thanks,

grtz
BjornW

-- 

met vriendelijke groet,
Bjorn Wijers

* b u r o b j o r n .nl *
digitaal vakmanschap | digital craftsmanship

Concordiastraat 68-126
3551 EM Utrecht
The Netherlands

phone: +31 6 49 74 78 70
http://www.burobjorn.nl
_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers

_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list