111
frankblack
Re: Ajax calls directly from Jquery
  • 2009/8/19 20:12

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Quote:
Now test it! Should I do more tutorials regarding jquery?


Of course! More important for me to know is how to access a certain function in a php file instead of creating a php file for every ajax.

Another matter seems to be interesting (maybe): What to do against some code overhead?

Case: Assume that there is an module that uses jquery in blocks and in other php files.
How to prevent that block and other php file load simultaneously jquery.js?

Possible:
a) add a define for each file/function where jquery is used and IF defined do not load jquery.js again
b) add jquery.js to your theme

But:
-> a) gets complicated if there are various modules using jquery
-> b) why load jquery while it is not used everywhere



112
frankblack
Re: PHP-Debugging without XOOPS
  • 2009/8/12 18:53

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Cool! Thx a million, I'll test an report. If it is really so simple ... then ...



113
frankblack
Re: PHP-Debugging without XOOPS
  • 2009/8/12 15:58

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


It appears to me, that ajaxify is far slower than xajax on the ajaxify demo site?!? AND if you want to process form data even the ajaxify code is a bit longer (can be seen in the demo). But you are right, xajax has some ugly drawbacks (unless someone has a solution to implement xajax as framework code so that it can be used anywhere anytime), so I will try ajaxify for a few functions, but I ask you to give me a helping hand. Will you?

I take just a basic example. What the script has to to do is select a radio station and shows the players that can be used with that radio station.

PHP function:
function xajaxradio($arg) {
        global 
$xoopsDB;

    
$radioselect $arg['radioselect'];

    
$result1 $xoopsDB->query("SELECT radio_id, radio_stream, canplay FROM ".$xoopsDB->prefix('debaserradio')." WHERE radio_id = ".intval($radioselect)."");
    list(
$radio_id$radio_stream$canplay) = $xoopsDB->fetchRow($result1);
    
$canplayarray explode(' '$canplay);

    
$result2 $xoopsDB->query("SELECT xpid, name, html_code, playericon FROM ".$xoopsDB->prefix('debaser_player')." WHERE xpid IN (".implode(', 'array_map('intval'$canplayarray)).")");

    
$imagerow '';

        while(
$fetch $xoopsDB->fetchArray($result2)) {
    if (
$fetch['html_code'] == 'external') {
        
$imagerow .= '<a href="'.$radio_stream.'" target="_blank"><img src="'.DEBASER_IMG.'/playericons/'.$fetch['playericon'].'" alt="'.$fetch['name'].'" title="'.$fetch['name'].'" />';
    } else {
    
$imagerow .= '<button type="button" name="button'.$fetch['xpid'].'" id="button'.$fetch['xpid'].'" value="'.$fetch['xpid'].'" onclick="javascript:openWithSelfMain(''.DEBASER_URL.'/radiopopup.php?radio='+document.radiolist.radioselect.options[document.radiolist.radioselect.selectedIndex].value+'&amp;player='.$fetch['xpid'].'','player',10,10)" /><img src="'.DEBASER_IMG.'/playericons/'.$fetch['playericon'].'" width="20" height="20" alt="'.$fetch['name'].'" title="'.$fetch['name'].'" /></button> ';
    }
        }

    
$content $imagerow;
    
$objResponse = new xajaxResponse();
    
$objResponse->assign("radiolistresponse","innerHTML"$content);
    return 
$objResponse;
    }


HTML code:
<{$block.xajax}>
<
form style="margin:0px; padding:2px;" name="radiolist" id="radiolist" method="post" action="radio_block.php">
<
select id="radioselect" name="radioselect" onchange="xajax_xajaxradio(this.options[this.selectedIndex].value)">
<
option>-<{$smarty.const._MB_DEBASERRAD_CHO}>-</option>
<{foreach 
item=radiolist from=$block.radiolist}>    
<{
$radiolist.options}>
<{/foreach}>
</
select>
</
form>
<
div id="radiolistresponse"></div>


I would like to see how this can be done with ajaxify. I just want to emphasize, that I don't want you to code for me, but just give me a little push into the right direction.

HINT HINT



114
frankblack
Re: First comments on 2.4
  • 2009/8/11 8:19

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Quote:
I even don't understand how this can be discussed ! A Php script starts with If you can't do it, don't code
Opinions differ from THIS to THIS. I prefer closing the tag, because it seems "natural" to me.



115
frankblack
Re: First comments on 2.4
  • 2009/8/11 7:01

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Quote:
I have updated 4 or 5 files in smarty. Some times is your php editor that does that. Are you using eclipse? Can you point me one of that files so I can check here?


Yes, I am using eclipse. class/smarty/plugins/modifier.cat.php or class/smarty/xoops_plugins/modifier.debug_print_var.php

I heard about the virtual closing of php files. But there should be a consistency in the files. Closing tag yes or no, this is the question.



116
frankblack
Re: First comments on 2.4
  • 2009/8/10 15:08

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


I still notice extra spaces / linefeeds in several files (smarty nearly all) after the closing ?>.

This COULD lead to problems (sometimes eventually)...

class/soap/soapfactory.php line instead of:
if (file_exists($GLOBALS['xoops']->path('class/soap/'.strtolower(XOOPS_SOAP_LIB).'/'.strtolower(XOOPS_SOAP_LIB).'.php'))

must be:
if (file_exists($GLOBALS['xoops']->path('class/soap/'.strtolower(XOOPS_SOAP_LIB).'/'.strtolower(XOOPS_SOAP_LIB).'.php')))


class/auth/auth_ads.php line 93 instead of:
else {

must be:
} else {


class/auth/auth_ldap.php line 146 instead of:
else {

must be:
} else {


edit: added to bug tracker



117
frankblack
Re: PHP-Debugging without XOOPS
  • 2009/8/10 10:28

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


@kaotik: of course I could use jquery, but this would mean to rewrite a lot of functions in my module. So maybe later. Besides when XOOPS becomes XHTML strict in a day far in the future (still even not XHTML transitional), we have to remove the target attribute which is now used with ajaxify.

About history and bookmarking: there are workarounds for that if I remember correctly.



118
frankblack
Re: PHP-Debugging without XOOPS
  • 2009/8/9 6:40

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Excellent! So rapidly my litte project started so rapidly it came to an end.

In fact if you need smarty debugging just log $xoopsTpl. Only thing which COULD be added is making a switch for selecting the groups e.g. like I did for all, regs only or admins only.

Thx Trabis



119
frankblack
Re: PHP-Debugging without XOOPS
  • 2009/8/8 22:47

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Not I did the awesome work, but the guys from Firefox, FireBug and FirePHP. I just made the quick and dirty hack. I am not fishing for compliments. Everyone else could have done this. This solution was born out of my own frustration that xajax and XOOPS were confusing each other with their debug methods.

So this was a waste product of my efforts on the work at my module. There are about two other waste products that could lead to other modules if I had the time. Maybe one day ...




120
frankblack
Re: PHP-Debugging without XOOPS
  • 2009/8/8 17:54

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Make sure Net and Console are activated. There is besides both a small triangle. Click this small triangle you'll get a pulldown where you can activate Net or Console. I see on your image that Net is not activated. The logs you'll see under the tab Console.

Did I mention that I am a bad teacher? Or doc writer?




TopTop
« 1 ... 9 10 11 (12) 13 14 15 ... 53 »



Login

Who's Online

136 user(s) are online (69 user(s) are browsing Support Forums)


Members: 0


Guests: 136


more...

Donat-O-Meter

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

Latest GitHub Commits