xoops forums

Will_H

Friend of XOOPS
Posted on: 2007/3/4 0:38
Will_H
Will_H (Show more)
Friend of XOOPS
Posts: 1786
Since: 2004/10/10
#1

Lets simplify this ajax thing.

Ajax is becoming more and more in demand. So I want to do some addons to header.php

It seems that certain functions should be integrated into the XOOPS core. For now, lets just make it easier for those of us too impatient to wait for this to occur.

With this simple hack I want to call these scripts with a smarty tag.

Here's what I did

in header.php

Find:
$xoopsTpl->assign('xoops_js''<script type="text/javascript" src="'.XOOPS_URL.'/include/xoops.js"></script>');


Add After
$xoopsTpl->assign('xoops_prototype''<script type="text/javascript" src="'.XOOPS_URL.'/include/prototype.js"></script>');
$xoopsTpl->assign('xoops_scriptaculous''<script type="text/javascript" src="'.XOOPS_URL.'/include/scriptaculous.js?load=effects"></script>');


By default scriptaculous.js loads the other .js files "dragdrop, effects, etc" as long as they are in the same directory.

Be sure to upload all of the .js files to your XOOPS_root/includes directory.

Now, instead of using this in my theme.html
<script type="text/javascript" src="<{$xoops_imageurl}>scripts/scriptaculous.js"></script>


I use
<{$xoops_scriptaculous}>
<{
$xoops_prototype}>


If I view the page source the scripts are being called properly... but the functionality is not there.

Any ideas?

snow77

Just can't stay away
Posted on: 2007/3/4 0:56
snow77
snow77 (Show more)
Just can't stay away
Posts: 864
Since: 2003/7/23
#2

Re: Lets simplify this ajax thing.

Yes.

For now it's XOOPS "default theme template issue" not a core issue.

It's up to us, the theme designers, what we define as standard in the "head" and "body".

If you, along with kris_fr who was done much efforts, and others, along with me who are doing theme functioning structures... we should open a some kind of "XOOPS theme template" kind of forum ..and start simplifying and structuring the functioning part, focused apart from the designing part.

snow77

Just can't stay away
Posted on: 2007/3/4 1:01
snow77
snow77 (Show more)
Just can't stay away
Posts: 864
Since: 2003/7/23
#3

Re: Lets simplify this ajax thing.

what can be proposed as head?
what can be proposed as body?

what can be proposed as alternate additions? (since we can't add a million include scripts in the head)

what documentation can be done?

nekro

Quite a regular
Posted on: 2007/3/4 2:25
nekro
nekro (Show more)
Quite a regular
Posts: 213
Since: 2005/11/9
#4

Re: Lets simplify this ajax thing.

In XOOPS 2.0.16 you can use the new theme Object and for example in the header.php is:
$xoTheme->addScript'/include/xoops.js', array( 'type' => 'text/javascript' ) );


You can also use that for scriptaculous too... in any page ... not necesary yo be included in header.php ...

Luck

Will_H

Friend of XOOPS
Posted on: 2007/3/4 14:31
Will_H
Will_H (Show more)
Friend of XOOPS
Posts: 1786
Since: 2004/10/10
#5

Re: Lets simplify this ajax thing.

@snow: I'm not sure I follow... The beauty behind scriptaculous is that it loads all of the additional scripts so you only have to call it+prototype. Perhaps it does not belong in the core.

I just feel that XOOPS should evolve with the web. The web isn't going to come back down to XOOPS standards. Somehow I think you believe the same, as I see you as one of the front runners in developing the XOOPS wireframe template.

@nekro: AH! I'll give that a swing.

The reason that I am trying to call it from header.php is because it is used in every single page. Seemed like the most logical place to define a smarty tag.

Thanks for your help

Bill_L

Just popping in
Posted on: 2007/3/4 14:43
Bill_L
Bill_L (Show more)
Just popping in
Posts: 14
Since: 2007/3/1 1
#6

How can I call the scriptaculous.js from the header.php

Quote:

snow77 wrote:
Yes.

For now it's XOOPS "default theme template issue" not a core issue.


I think Wills post above is not to encompass every ajax script. It looks like he was asking a specific question! In which he was trying to call the scriptaculous.js from the head for a project that he is working on.



Thanks for keeping the post on topic.

Will_H

Friend of XOOPS
Posted on: 2007/3/4 15:01
Will_H
Will_H (Show more)
Friend of XOOPS
Posts: 1786
Since: 2004/10/10
#7

Re: Lets simplify this ajax thing.

Well yes, exactly Bill.

In doing so it seems that I have brung up a new topic.

I think that it is inevitable that these scripts as well as many more are going to be more and more frequent in the coming years. Especially in regards to integration with XOOPS.

While to us, it may seem like childs play to simply drop this into a scripts folder and call it from the theme. To a novice it would be like playing spiderman on the empire state building.

Not only this, but this would enable Theme, and module designers to lessen the amount of files in each and every download. After all it is my bandwidth that is being consumed with each and every theme I release.

So not only am I sharing my work for free, but I am paying for each and every download.

So whats the harm in looking into saving myself some money in the long run?

Will_H

Friend of XOOPS
Posted on: 2007/3/6 12:13
Will_H
Will_H (Show more)
Friend of XOOPS
Posts: 1786
Since: 2004/10/10
#8

Re: Lets simplify this ajax thing.

no comments?

mmmkay.