1
Anonymous
javascript help....how to get the modules to use?
  • 2004/7/7 16:50

  • Anonymous

  • Posts: 0

  • Since:


I am having some trouble with a javascript code. I have placed it in my theme.html file like so:

<script="text/javascript" "src=sourcefile.js">script>


It works fine on the main page as long as I don't use a module a start page. But if I go to a module or use a module for a start page like "news" for instance, it doesn't work. The modules dont pick up the javascript.

What is the proper way of insterting javascript into a theme so that all of the modules use it.

In case you are wondering, I am wanting to use the Dynamic Text Replacement feature I saw on A list apart

2
tl
Re: javascript help....how to get the modules to use?
  • 2004/7/7 17:11

  • tl

  • Friend of XOOPS

  • Posts: 999

  • Since: 2002/6/23


I think it should be (as instructed by the article). Too eager to implement?

type="text/JavaScript"
src="replacement.js">

3
Anonymous
Re: javascript help....how to get the modules to use?
  • 2004/7/7 17:17

  • Anonymous

  • Posts: 0

  • Since:


I have tried that and it doesn't work with modules


It will only work if I have a standalone page or the XOOPS main page without any modules

4
tl
Re: javascript help....how to get the modules to use?
  • 2004/7/7 17:29

  • tl

  • Friend of XOOPS

  • Posts: 999

  • Since: 2002/6/23


Assuming you have inserted the script inside the bracket, then it is very strange not working. Maybe some javascript gurus could help you out.

5
Anonymous
Re: javascript help....how to get the modules to use?
  • 2004/7/7 17:55

  • Anonymous

  • Posts: 0

  • Since:


Just so you can see here is what the page looks like

my site This is the front page.

News This is the module homepage.

There isn't anything on my site.....I am just in the "planning" stage right now for what modules and design I want to implement.

Thanks for any help

Cat

6
ackbarr
Re: javascript help....how to get the modules to use?

<script type="text/JavaScript" src="replacement.js"script>

the code you used specifies a relative link, meaning that it looks for the file specified, relative to the current page.

so when the page is http://www.mysite.com/index.php the web browser requests:
http://www.mysite.com/replacement.js

in the news module the url is http://www.mysite.com/modules/news/index.php so the web browser requests:
http://www.mysite.com/modules/news/replacement.js

To fix this, use a fixed path link:
<script type="text/JavaScript" src="[b]<{$xoops_url}>/[/b]replacement.js"script>

should do the trick.

7
Anonymous
Re: javascript help....how to get the modules to use?
  • 2004/7/7 18:26

  • Anonymous

  • Posts: 0

  • Since:


ackbarr,

Thanks....that made sense. Unfortunately, it didn't make a darn bit of difference.

Hmmm....will have to come back to it later I guess.

Thanks for help

8
ackbarr
Re: javascript help....how to get the modules to use?

after digging into it a bit further, you have the same problem in the javascript function com_stewartspeak_replacement()
Change this:
replaceSelector("h1","heading.php",true);
var 
testURL "test.png" ;

var 
doNotPrintImages false;
var 
printerCSS "replacement-print.css";

var 
hideFlicker false;
var 
hideFlickerCSS "replacement-screen.css";
var 
hideFlickerTimeout 1000;


to:
replaceSelector("h1","/heading.php",true);
var 
testURL "/test.png" ;

var 
doNotPrintImages false;
var 
printerCSS "/replacement-print.css";

var 
hideFlicker false;
var 
hideFlickerCSS "/replacement-screen.css";
var 
hideFlickerTimeout 1000;

and see if you get better results.

9
Anonymous
Re: javascript help....how to get the modules to use?
  • 2004/7/7 20:03

  • Anonymous

  • Posts: 0

  • Since:


Quote:
and see if you get better results.


THANK YOU! It is definitely working now. It is all the little things. I especially appreciate you taking the time to look at the file.

[song]Oh, sooooo happy now....ohh ohh so happy now.[/song]


Login

Who's Online

446 user(s) are online (144 user(s) are browsing Support Forums)


Members: 0


Guests: 446


more...

Donat-O-Meter

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

Latest GitHub Commits