1
th0th696
using javascript in custom blocks?
  • 2006/7/20 16:33

  • th0th696

  • Just popping in

  • Posts: 7

  • Since: 2006/3/29


I am trying to figure out how I can integrate Adobe into my workflow building XOOPS sites. Imageready is fairly quick for building rollovers and simple animations for buttons. Here's an example of what image ready will dump out in terms of html and images:

imagereadyRolloverExample

So I want to use this in a custom block on the left. There's actually a ton of code for all the rollovers. It starts with a javascript section, which I am thinking should be going in the theme somewhere as when I copy everything within the tags into a custom block it doesn't seem to work. Does anyone have suggestions as to how this might be done? I'd copy the source into here, but it might be excessive use of the database, and you can use the link above and tell your browser to view source.

2
Daigoro
Re: using javascript in custom blocks?
  • 2006/7/21 15:30

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


The easy way, would be to include javascript and html in your custom block.
And then manually edit the path to where you want the links to point.
Best regards,
Daigoro

3
th0th696
Re: using javascript in custom blocks?
  • 2006/7/21 19:01

  • th0th696

  • Just popping in

  • Posts: 7

  • Since: 2006/3/29


Well I did try to make a custom block. But everything came out rather wonky (as if the script hadn't run). So I guess is there a description somewhere of what tags should go in a block? And where do I place the script? I don't think putting a header in a block works (seems this would conflict with theme's header). Also the body tag contains things in it that seem likely to be necessary.




Notice the onload="preloadImages()";

I guess I'm just really confused how you use html in a block versus how it's used in a standard web page. What tags are necessary (html?head?body?) and which ones are usable (
4
Daigoro
Re: using javascript in custom blocks?
  • 2006/7/21 19:43

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


A custom block should only contain the inside of the body.
Xoops takes care of all the rest.
In other words, only the lines marked X below:

<html>
 <
head>
 head>
 <
body>
  
X
  X
 
body>
html>


Most of the other things you mention, should be in your theme's css file - and the javascript preloader should be in your theme.html.

An alternative is to insert an iframe into your custom frame. Then you can load a full and seperate html page into it.

Good luck.
Best regards,
Daigoro

5
th0th696
Re: using javascript in custom blocks?
  • 2006/7/21 22:33

  • th0th696

  • Just popping in

  • Posts: 7

  • Since: 2006/3/29


Okay just to make sure:

1. stuff between the tag should be in the header of the theme.html file, as well as the call to the preloadImages function.

2. everything in should be in the block itself.

3. I am confused as to what I mentioned that might go in the CSS file.

Sound good? Thank you for your help, I was getting quite confused here.

EDIT: I am doing something wrong still. While editing theme.html I noticed a

I was wondering if that $xoops_js is an indication that maybe I need to insert this javascript into the database to be called into existence here. Or it might just be some default xoopsJavaScripting that wasn't meant to be changed.

6
Daigoro
Re: using javascript in custom blocks?
  • 2006/7/22 22:15

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


If you are just trying to make one custom block, and want to insert static code in there, then the easiest would simply be to insert all the code (slightly reordered) into your custom block. I'll show how it's done further down.
Note, you can't have two blocks made this way - as they will share javascript function names and only one of them will persist.

If you, on the other hand, wants to make themes, based on your Imageready output, then you need to understand some more code and you need to edit more files.

If you look at the body tag example you gave a few postings ago:


Here the bgcolor, leftmargin, topmargin, marginwidth and marginheight are all css elements, related to the entire pages body - not just the block.
If you want to make those changes to the entire site, then you should change it in your themes css file.

The onload property, will trigger the preloader once the entire page has been loaded - it will then load all the images needed for the mouseover function in the background. If it's for a theme, then you want to put it in the body tag in the themes html file.

Finally, the javascript part of your output. It's not written very clever, nut nevertheless you would probably want to put it in a seperate javascript file, and link to it from inside the themes html file.

About your questions regarding the <{$xoops_js}> this is where XOOPS loads the javascript functions thats available from the XOOPS system. You could add a link to your javascript file next to it.

Still, the very very easy way, is to stick all of it into the block.
I've reordered the code and have added URL's to make the code testable from here. Try to add all of this as your custom blocks contents:
<script type="text/javascript">

script>



<
table id="Table_01" width="185" height="330" border="0" cellpadding="0" cellspacing="0">
    <
tr>
        <
td>

            <
a href="#"
                
onmouseover="changeImages('home', 'http://ebay.thalhalla.net/mainmenu+html/images/home-over.gif'); return true;"
                
onmouseout="changeImages('home', 'http://ebay.thalhalla.net/mainmenu+html/images/home.gif'); return true;"
                
onmousedown="changeImages('home', 'http://ebay.thalhalla.net/mainmenu+html/images/home-down.gif'); return true;"
                
onmouseup="changeImages('home', 'http://ebay.thalhalla.net/mainmenu+html/images/home-over.gif'); return true;">
                <
img name="home" src="http://ebay.thalhalla.net/mainmenu+html/images/home.gif" width="185" height="38" border="0" alt="">a>td>
    tr>
    <
tr>
        <
td>
            <
a href="#"
                
onmouseover="changeImages('about', 'http://ebay.thalhalla.net/mainmenu+html/images/about-over.gif'); return true;"
                
onmouseout="changeImages('about', 'http://ebay.thalhalla.net/mainmenu+html/images/about.gif'); return true;"
                
onmousedown="changeImages('about', 'http://ebay.thalhalla.net/mainmenu+html/images/about-down.gif'); return true;"
                
onmouseup="changeImages('about', 'http://ebay.thalhalla.net/mainmenu+html/images/about-over.gif'); return true;">
                <
img name="about" src="http://ebay.thalhalla.net/mainmenu+html/images/about.gif" width="185" height="35" border="0" alt="">a>td>
    tr>
    <
tr>

        <
td>
            <
a href="#"
                
onmouseover="changeImages('secretassassin', 'http://ebay.thalhalla.net/mainmenu+html/images/secretassassin-over.gif'); return true;"
                
onmouseout="changeImages('secretassassin', 'http://ebay.thalhalla.net/mainmenu+html/images/secretassassin.gif'); return true;"
                
onmousedown="changeImages('secretassassin', 'http://ebay.thalhalla.net/mainmenu+html/images/secretassassin-down.gif'); return true;"
                
onmouseup="changeImages('secretassassin', 'http://ebay.thalhalla.net/mainmenu+html/images/secretassassin-over.gif'); return true;">
                <
img name="secretassassin" src="http://ebay.thalhalla.net/mainmenu+html/images/secretassassin.gif" width="185" height="63" border="0" alt="">a>td>
    tr>
    <
tr>
        <
td>
            <
a href="#"
                
onmouseover="changeImages('faq', 'http://ebay.thalhalla.net/mainmenu+html/images/faq-over.gif'); return true;"
                
onmouseout="changeImages('faq', 'http://ebay.thalhalla.net/mainmenu+html/images/faq.gif'); return true;"
                
onmousedown="changeImages('faq', 'http://ebay.thalhalla.net/mainmenu+html/images/faq-down.gif'); return true;"
                
onmouseup="changeImages('faq', 'http://ebay.thalhalla.net/mainmenu+html/images/faq-over.gif'); return true;">
                <
img name="faq" src="http://ebay.thalhalla.net/mainmenu+html/images/faq.gif" width="185" height="45" border="0" alt="">a>td>
    tr>

    <
tr>
        <
td>
            <
a href="#"
                
onmouseover="changeImages('news', 'http://ebay.thalhalla.net/mainmenu+html/images/news-over.gif'); return true;"
                
onmouseout="changeImages('news', 'http://ebay.thalhalla.net/mainmenu+html/images/news.gif'); return true;"
                
onmousedown="changeImages('news', 'http://ebay.thalhalla.net/mainmenu+html/images/news-down.gif'); return true;"
                
onmouseup="changeImages('news', 'http://ebay.thalhalla.net/mainmenu+html/images/news-over.gif'); return true;">
                <
img name="news" src="http://ebay.thalhalla.net/mainmenu+html/images/news.gif" width="185" height="49" border="0" alt="">a>td>
    tr>
    <
tr>
        <
td>
            <
a href="#"
                
onmouseover="changeImages('partners', 'http://ebay.thalhalla.net/mainmenu+html/images/partners-over.gif'); return true;"
                
onmouseout="changeImages('partners', 'http://ebay.thalhalla.net/mainmenu+html/images/partners.gif'); return true;"
                
onmousedown="changeImages('partners', 'http://ebay.thalhalla.net/mainmenu+html/images/partners-down.gif'); return true;"
                
onmouseup="changeImages('partners', 'http://ebay.thalhalla.net/mainmenu+html/images/partners-over.gif'); return true;">
                <
img name="partners" src="http://ebay.thalhalla.net/mainmenu+html/images/partners.gif" width="185" height="50" border="0" alt="">a>td>

    tr>
    <
tr>
        <
td>
            <
a href="#"
                
onmouseover="changeImages('contact', 'http://ebay.thalhalla.net/mainmenu+html/images/contact-over.gif'); return true;"
                
onmouseout="changeImages('contact', 'http://ebay.thalhalla.net/mainmenu+html/images/contact.gif'); return true;"
                
onmousedown="changeImages('contact', 'http://ebay.thalhalla.net/mainmenu+html/images/contact-down.gif'); return true;"
                
onmouseup="changeImages('contact', 'http://ebay.thalhalla.net/mainmenu+html/images/contact-over.gif'); return true;">
                <
img name="contact" src="http://ebay.thalhalla.net/mainmenu+html/images/contact.gif" width="185" height="44" border="0" alt="">a>td>
    tr>
    <
tr>
        <
td>
            <
img src="http://ebay.thalhalla.net/mainmenu+html/images/mainmenubar_08.gif" width="185" height="6" alt="">td>

    tr>
table>


<
script type="text/javascript">preloadImages();script>


I hope this clearifies a bit for you.
Best regards,
Daigoro

7
th0th696
WORKS!!!
  • 2006/7/23 4:04

  • th0th696

  • Just popping in

  • Posts: 7

  • Since: 2006/3/29


Yay it works!!! Cheers!

Thank you for taking the long way around to explain as well. I did just copy your revision in wholesale, which works great! But now I do want to take the extra steps to learn what's going on under the hood of xoops. And I'll start fiddling around with your other suggestions of moving the scripting elsewhere. Hopefully learning some more along the way. Once again many thanks. And cheers!

8
Daigoro
Re: WORKS!!!
  • 2006/7/23 10:05

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


It's good to know it's working for you.

A small amount of knowledge is the key to a huge amount of knowledge. (Just add a bit of work to the formula!)

Good speed...
Best regards,
Daigoro

Login

Who's Online

500 user(s) are online (54 user(s) are browsing Support Forums)


Members: 0


Guests: 500


more...

Donat-O-Meter

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

Latest GitHub Commits