Hi;
I have done some modifications to the default theme (xoops1.0.16) to make urls load via rico. this should work for any theme.
this work is not done yet completely, but if you are interested on the matter you can test it. I am wondering if we can work on this and make it work better.
you can download a ready theme pack called "defaultaj" from:
http://www.fanafzar.com/uploads/defaultaj.rar it is about 440K just unpack it in your theme folder.
NOTICE: as I said many links may not work properly this is just an idea.
If you need more details you can continue to read else you can test the file you downloaded above;
How to:
To do this you need to have rico files, you can download at:
http://www.openrico.org you can also download them from this url:
http://www.fanafzar.com/uploads/Rico.rarput the Rico folder in your theme folder, now you need to link these scripts in your theme:
<script type="text/javascript" src="<{$xoops_imageurl}>Rico/prototype.js">script>
<script type="text/javascript" src="<{$xoops_imageurl}>Rico/rico.js">script>
now we need a little more javascript, add the following code just after the above lines in your theme.html file:
<script language="javascript">
function sanitizeATags(){
atags = document.getElementsByTagName('a');
for(var i = 0; i < atags.length; i++){
if((atags[i].href != '') && (atags[i].href.indexOf('<{$xoops_url}>') == 0)){
onClickAttribut = document.createAttribute("onClick");
onClickAttribut.nodeValue = "getPage('"+atags[i].href+"');";
atags[i].setAttributeNode(onClickAttribut);
atags[i].href = "javascript:void(0);";
}
}
}
var page_obj = Class.create();
page_obj.attributes = [ "url", "title", "content" ];
page_obj.prototype = {
initialize: function() {
},
ajaxUpdate: function(ajaxResponse) {
this.placePage(ajaxResponse.childNodes);
},
placePage: function(page_responce) {
var pageHolder = '';
//pageHolder += page_responce[0].getAttribute('url') + " - " + page_responce[0].getAttribute('title') + " - " + page_responce[0].childNodes[0].childNodes[0].nodeValue;
pageHolder += page_responce[0].childNodes[0].childNodes[0].nodeValue;
document.getElementById('ajax_content').innerHTML = pageHolder;
sanitizeATags();
}
};
var page_obj;
function registerAjaxPage(url) {
ajaxEngine.registerRequest( 'getPage', url );
ajaxEngine.registerAjaxObject( 'page', new page_obj() );
}
function getPage(url) {
registerAjaxPage(url);
ajaxEngine.sendRequest( 'getPage', "ajaxpage=1" );
}
script>
ok lets call sanitizeATags() function to make our Rico enabled links, to do this just replace:
with:
in order to have a unique element to deal with lets add an extra div element for this just replace:
<div id="content">
<{$xoops_contents}>
div>
with:
<div id="content">
<div id="ajax_content">
<{$xoops_contents}>
div>
div>
and finally we need some php code in our theme. we do this by adding 2 parts, one at the beginning of the theme.html file and one small part at the end of it. the code to add at the beginning (just before:
if(isset($_GET['ajaxpage'])){
header("Content-type: text/xml; charset=UTF-8");
echo '';
if(isset($_GET['blocks'])){
<{/php}><ajax-response>
<response type="object" id="blocks">
<{php}>
$sid = 1;
$title = "title";
$content = "Block Content!!";
echo ".$sid."' title='<".$title."' content='".$content."' />";
<{/php}>
response>
ajax-response><{php}>
}else{
echo '';
echo '';
$url = "page url";
$title = $this->_tpl_vars['xoops_sitename'] . ' - ' . $this->_tpl_vars['xoops_pagetitle'];
echo '.$url.'" title="'.$title.'">';
echo '';
echo '.$this->_tpl_vars['xoops_module_header'].$this->_tpl_vars['xoops_contents'].']]>';
echo '';
echo '';
echo '';
echo '';
}
}else{
<{/php}>
and at the end of theme.html file (just after ):
<{php}>
}
<{/php}>
and that’s all, empty templates_c folder, and turn off debug mode, and make a test. I am waiting for your feed back.
So What:
xoops is a great system.