81
frankblack
Re: debaser 3.01 pre-alpha
  • 2009/10/12 6:25

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


OK, I put it back in!



82
frankblack
Re: debaser 3.01 pre-alpha
  • 2009/10/2 11:45

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


First draft of debaser's administration (3.01 pre-alpha) is out and can be downloaded HERE (PDF, 3.2 MB).



83
frankblack
Re: Ajax in block
  • 2009/9/30 7:41

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Quote:
To tell you the truth i been looking into debaser before you say that . :) i learned some from it .


Cough! You must be joking! Learning how to do it NOT I assume.

Of course your code is much shorter/quicker than mine, but I am using jquery anyway so I don't care. Especially I like the eye candy that comes with some jquery scripts.



84
frankblack
Re: Ajax in block
  • 2009/9/30 6:42

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


You could use Firebug for debugging. I made something similar for debaser, with a jquery script called autocomplete. Works similar to Google Suggest.

Template:
<form name="ajaxsearcher" id="ajaxsearcher" action="javascript:void(null);" method="post">
<
div id="debsearchdiv">
<
span class="debsearchword"><{$smarty.const._MD_DEBASER_SEARCH}></span><input type="text" id="ajaxsearch" /> <img src="<{$smarty.const.DEBASER_IMG}>/dialog-ok.png" name="debsearchsubmit" style="float:left" id="debsearchsubmit" alt="<{$smarty.const._SUBMIT}>"  title="<{$smarty.const._SUBMIT}>" />
</
div>
</
form>
<
div id="searchresponse"></div>

<
script type="text/javascript" src="<{$xoops_url}>/modules/debaser/js/jquery.bgiframe.min.js"></script>
<
script type="text/javascript" src="<{$xoops_url}>/modules/debaser/js/jquery.ajaxQueue.js"></script>
<
script type="text/javascript" src="<{$xoops_url}>/modules/debaser/js/jquery.autocomplete.pack.js"></script>
<
script type="text/javascript">
$().
ready(function() {

    $(
"ajaxsearcher").attr({ autocomplete:"off" });
    
    function 
formatItem(row) {
        return 
row[0] + " (<strong>id: " row[1] + "</strong>)";
    }
    function 
formatResult(row) {
        return 
row[0].replace(/(<.+?>)/gi, '');
    }

    $("#ajaxsearch").autocomplete("debasersearch.php", {
        width: 260,
        selectFirst: false
    });

    $("#debsearchsubmit").click(function () {
        $("#searchresponse").load("<{$xoops_url}>/modules/debaser/ajaxed.php", { action : "ajaxsearch", searchitem1 : document.getElementById('ajaxsearch').value });
        });
    
});


</script>


debaser_search.php:
<?php
include 'header.php';

    if (isset(
$_GET['q']) && $_GET['q'] != '') {

        
$getquery addSlashes($_GET['q']);
        
$getlimit intval($_GET['limit']);

        
$result $xoopsDB->query("SELECT artist, title, genreid FROM ".$xoopsDB->prefix('debaser_files')." WHERE title LIKE '%$getquery%' OR artist LIKE '%$getquery%' OR album LIKE '%$getquery%' OR year LIKE '%$getquery%' OR year LIKE '%$getquery%' OR length LIKE '%$getquery%' OR frequence LIKE '%$getquery%' OR bitrate LIKE '%$getquery%' LIMIT $getlimit");

        while(list(
$artist$title$genreid) = $xoopsDB->fetchRow($result)) {
            if (
$gperm_handler->checkRight('DebaserCatPerm'$genreid$groups$module_id)) echo $artist." "."$titlen";
        }
    }

?>


ajaxed.php:
<?php
    
if (isset($_POST['action']) && $_POST['action'] == 'ajaxsearch') {

        
// check the values
        
$searchitem1 = isset($_POST['searchitem1']) ? addSlashes($_POST['searchitem1']) : '';

        
$result $xoopsDB->query("SELECT xfid, artist, title FROM ".$xoopsDB->prefix('debaser_files')." WHERE CONCAT_WS(' ', artist, title) LIKE '$searchitem1' OR artist LIKE '%$searchitem1%' OR title LIKE '%$searchitem1%'");

        
$returnresult '<br /><div id="debsearchresults"><h1>'._MD_DEBASER_SEARCHRES.'</h1>';

        while(list(
$getback$getback2$getback3) = $xoopsDB->fetchRow($result)) {
            
$returnresult .= '<span style="line-height:150%"<a href="'.DEBASER_URL.'/singlefile.php?id='.$getback.'">'.$getback2.' '.$getback3.'<br /></span>';
        }

        
$returnresult .= '</div>';
        echo 
$returnresult;
    }

?>


CSS:
/* autocomplete css */
.ac_results {
padding0px;
border1px solid black;
background-colorwhite;
overflowhidden;
z-index99999
}
.
ac_results ul {
width100%;
list-
style-positionoutside;
list-
stylenone;
padding0;
margin0
}
.
ac_results li {
margin0px;
padding2px 5px;
cursor: default;
displayblock;
fontmenu;
font-size12px;
line-height16px;
overflowhidden
}
.
ac_loading {
backgroundwhite url('../images/indicator.gif'right center no-repeat
}
.
ac_odd {
background-color#eee
}
.
ac_over {
background-color#231f20;
colorwhite
}

div#debsearchdiv {
padding2px;
background-color#231f20;
color#fff;
font-size12px;
height:24px
}

input#ajaxsearch {
height19px;
font-size12px;
width251px;
padding-top4px;
padding-left5px;
padding-right5px;
padding-bottom0px;
margin0px;
floatleft;
bordernone;
}
.
debsearchword {
float:left;
padding-right:5px;
padding-top:5px;
padding-left:5px;
font-weight:bold
}
div#debsearchresults {
padding10px;
background-color#231f20;
font-size12px
}
div#debsearchresults a {
colorsilver;
}
div#debsearchresults a:hover {
text-decorationunderline
}
div#debsearchresults h1 {
font-size18px;
font-weightbold;
color#fff;
margin-top0px
}


edit: this code might not work, because the textsanitizer killed backslashes used at some places, but I hope it shows you the way.



85
frankblack
Re: constants in blocks VS constants in other module files
  • 2009/9/29 15:28

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Quote:
The magic of the PHP static statement is that it allows a function to "remember" the value of a local variable for the next time the function is called.


Thx for the link, but ... perhaps I get this wrong? I am doing what I am told and put a static variable inside the function of the module file. So the variable keeps its value even when the function is finished. Does this help me in my case? Does the function of the BLOCK do know about the kept value of module file? If yes, what happens if I leave the page of the module file? Is the value still kept? This would be bad as before, because then the block would not get the javascript and css because it thinks that some files are still loaded.

I guess I am not skilled enough to answer these question/problem.



86
frankblack
Re: constants in blocks VS constants in other module files
  • 2009/9/29 13:35

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Got it working with defines!! ->WRONG!!!

If you want to set a define-flag inside you can just put it inside the function. If you want to set a define-flag inside a module file you have to put it at a place BEFORE header.php from xoopsroot is included. Simple as that! So I can revert using get_included_files.

I just found out accidently, because one module file (before header.php) was working and the other (after header.php) was not working.


Sorry for wasting others peoples time.

Edit: Rubbish! This is NOT working, when you add another block.



87
frankblack
Re: XOOPS ZenCart Module 0.3 Login Problems!!!
  • 2009/9/29 9:06

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


I would not use this module, because the code is old and not maintained (based on 1.30, current version is 1.3.8) -> lot of security holes. The site were I used the module was hacked even before I was finished with administration.



88
frankblack
Re: constants in blocks VS constants in other module files
  • 2009/9/28 15:12

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


No idea, how to do this, but found another way.



89
frankblack
Re: constants in blocks VS constants in other module files
  • 2009/9/28 12:23

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


My problem is that several blocks and files are using the same javascript. IF I add the javascript for every block or file the javascript is added over and over again. At some points the javascript will not work properly. Of course I can say "add the javascript files to your theme". Easy but not elegant, because why should javascript be loaded, when in most places it is not used?

So finally I think I have to hack the core a bit to use a setFlag function.



90
frankblack
Re: constants in blocks VS constants in other module files
  • 2009/9/28 12:02

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Case 1: Block A is displayed but NOT block B or module file C. All is fine!
Case 2: Block A and B are displayed at the same time. Block B should not use code which is already executed with Block A.
Case 3: Block A and B and module file C are displayed at the same time. Block A and B should not use code which is already executed with module file C.

So I have to set a flag or something. Thought initially that I could use defines.




TopTop
« 1 ... 6 7 8 (9) 10 11 12 ... 53 »



Login

Who's Online

227 user(s) are online (153 user(s) are browsing Support Forums)


Members: 0


Guests: 227


more...

Donat-O-Meter

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

Latest GitHub Commits