Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
1 + 3 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
     
_tpl_vars['xoops_lblocks'] as $block){ echo ''; echo ''; echo ''; echo ''; echo ''; } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; }else{ //echo ''; echo ''; echo ''; global $xoopsOption, $xoopsConfig, $xoopsModule, $xoopsRequestUri; $url = str_replace('?ajaxpage=1','?',($_SERVER['HTTP_HOST'].$xoopsRequestUri)); $url = str_replace('&ajaxpage=1','',$url); $url = str_replace('?_=','?',$url); $url = str_replace('&_=','',$url); $url = str_replace('_=','',$url); $url = urlencode($url); if($xoopsModule){ $module = $xoopsModule->getVar('dirname'); }else{ $module = '_nomodule_'; } //$title = "page title"; $title = $this->_tpl_vars['xoops_sitename'] . ' - ' . $this->_tpl_vars['xoops_pagetitle']; echo ''; echo ''; echo '_tpl_vars['xoops_module_header'].$this->_tpl_vars['xoops_contents'].']]>'; echo ''; echo ''; echo ''; echo ''; echo ''; //echo ''; echo ''; echo ''; } }else{ [/code] the javascript to handle this is: [code] /* * * farshid: * function sanitizeATags * called when ever we need to make tags call rico functions * 1- create and attach proper onClick attribute * 2- remove the href * 3- some criteria should exict as we need some links not vhanged (ex. /admin.php) * */ function sanitizeATags(){ /* * get all tags and put them in atags variable */ atags = document.getElementsByTagName('a'); /* * run throgh all atags, first we will check these: * atags[i].href != '' a element is linked to somewhere * atags[i].href.indexOf('admin') == -1 skip admin link(s) * atags[i].target != '_blank' skip links that will open in new window (ex. banners) * atags[i].href.indexOf('') == 0 href attribute starts with our site url * */ for(var i = 0; i < atags.length; i++){ if((atags[i].href != '') && (atags[i].href.indexOf('admin') == -1) && (atags[i].target != '_blank') && (atags[i].href.indexOf('') == 0)){ /* * * create an onClick attribute, set ints value to the proper function call: getPage(url) * the url comes from atag href attribute. * after creating it we will append it to the element and set the href attribute: javascript:void(0); * this will disable the link from going anywhere. * * NOTICE: setAttributeNode is not supported in explorer. * */ onClickAttribut = document.createAttribute("onClick"); onClickAttribut.nodeValue = "getPage('"+atags[i].href+"');"; atags[i].setAttributeNode(onClickAttribut); //atags[i].setAttribute(onClickAttribut); atags[i].href = "javascript:void(0);"; } } } /* * * farshid: * function sanitizeFormTags * called when ever we need to make tags call rico functions * */ function sanitizeFormTags(){ /* * get all tags and pit them in formtags variable */ formtags = document.getElementsByTagName('form'); /* * run throgh all formtags: */ for(var i = 0; i < formtags.length; i++){ /* * first we will check if the form action is compelete, many forms * hase relative actions to the page they are loaded in. * this needs some work, to do its job properly. * * NOTICE: setAttributeNode is not supported in explorer. * */ if(formtags[i].getAttribute('action').indexOf('http://')!=0){ actionAttribut = document.createAttribute("action"); actionAttribut.nodeValue = '/'+formtags[i].getAttribute('action'); formtags[i].setAttributeNode(actionAttribut); } /* * * Next we will check for these: * formtags[i].getAttribute('method') != '' form hase some methods! * formtags[i].getAttribute('method') == 'get' in this part we are going to sanitize forms with ger method * formtags[i].getAttribute('action').indexOf('' action attrin starts with our site url * */ if((formtags[i].getAttribute('method') != '') && (formtags[i].getAttribute('method') == 'get') && (formtags[i].getAttribute('action').indexOf('') == 0)){ /* * we are in our form with get methis, lets take all form elements */ formElements = formtags[i].elements; /* * loop throgh all elements to find submit and button types. */ for(var j =0; j

Re: an ajax aproach in theme
by farshid on 2007/3/13 7:38:56

Hi all;

as I think the code I am working on, has exceeded the concept of just being in the theme area I have started a new thread here: https://xoops.org/modules/newbb/viewtopic.php?topic_id=57726&forum=8

so I will continue to post there, if some webmasters here finds it possible to merge these 2 threads, I will appreciate the time and effort of doing so.

Thanks.
Re: an ajax aproach in theme
by rabideau on 2007/3/11 14:40:28

Hi all,

For those who'd like to see (and help further develop?) Ajax based themes, we have a small project started on http://helpxoops.info.

This effort is based upon Damasters materials (actually it is his materials without modification, right now).

A great demo site to view this in action is: http://demo.xoopserver.com/

Any takers???? Stop by and register to help at: http://helpxoops.info
Re: an ajax aproach in theme
by xguide on 2007/3/7 8:49:04

Hi Farshid,

Glad to see you around.
I would not say that JSON is completely secure.
But with XMLHTTPRequest + JSON we get the best performance
(easier to code and i believe to fix too).



P.S. Damaster works is based on some array/object issue reported by Joe. I'll check the code and post here or pm.
Re: an ajax aproach in theme
by farshid on 2007/3/7 8:40:26

OOPS, read it right now, thats OK, we will switch to JSON, I just need some time.
Re: an ajax aproach in theme
by farshid on 2007/3/7 8:32:33

OK, I got what you mean, some how;
I want you to explain this a little bit more, cause I think an Ajax request could not call something out of its resided domain, correct me if I am wrong, what I have got from your post is that the problem here is the XML format used to send data which you suggest to be replaced with JSON, so please let me know what is the advantage of using JSON instead of XML, if your reasons are enough we will for sure make it work through JSON.

I will give JSON a try, I have not used it before but I know it is possible to use it with Rico and as you said it exists is prototype library; this way our next step will be to make these scripts work through JSON, not XML, If I have got what you mean we should out put page and blocks data via JSON... is that OK with you?
and do you think this will solve some problems?

I am waiting for any suggestions and data on the matter.

Who's Online

224 user(s) are online (146 user(s) are browsing Support Forums)


Members: 0


Guests: 224


more...

Donat-O-Meter

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

Latest GitHub Commits