1
Shiva
Including javascript
  • 2009/9/28 18:53

  • Shiva

  • Quite a regular

  • Posts: 280

  • Since: 2006/7/9 1


Hi All,

I need to include javascript into my code but I also need to pass a smarty variable (namely $xoops_url). So the only way I can see to do this is by putting the code into theme.html. But I would much rather include a path to the js file to make the code cleaner.

Right now I have temporarily hard coded the path instead of putting it into theme.html.

Any suggestions?

Thanks in advance.


2
ghia
Re: Including javascript
  • 2009/9/28 22:45

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


In your theme you can do this:
<script type=text/javascript>
var 
XoopsPath = <{$xoops_url}>;
script
<
script type=text/javascript src=test.js>script>
In eg. test.js, you can then make use of the XoopsPath variable.

3
Shiva
Re: Including javascript
  • 2009/9/29 7:24

  • Shiva

  • Quite a regular

  • Posts: 280

  • Since: 2006/7/9 1


That's brilliant - Thank you!

Login

Who's Online

404 user(s) are online (292 user(s) are browsing Support Forums)


Members: 0


Guests: 404


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits