31
BigJim
Re: Classifieds replies.php - what does it do?
  • 2008/6/19 2:15

  • BigJim

  • Just popping in

  • Posts: 78

  • Since: 2007/7/16


Hi John

Great! I'd deleted the column out from the template by mistake

Thanks for a really great module!



32
BigJim
Classifieds replies.php - what does it do?
  • 2008/6/17 2:21

  • BigJim

  • Just popping in

  • Posts: 78

  • Since: 2007/7/16


Hi there

I'm using the classifeds module - a great module.

There is a page called 'replies.php' but I cannot see what it does and I cannot find any links to it in the module. Its quite likely I've deleted them when making layout changes.

Can someone tell me what it does/where it is?

thanks a lot!



33
BigJim
Re: Can newbb search me made to stop repeating results?
  • 2008/6/17 2:15

  • BigJim

  • Just popping in

  • Posts: 78

  • Since: 2007/7/16


Hi Trabis

thanks a lot

I've tried to figure out what you mean but I'm afraid I can't

Can you post the code?




34
BigJim
Can newbb search me made to stop repeating results?
  • 2008/6/3 7:20

  • BigJim

  • Just popping in

  • Posts: 78

  • Since: 2007/7/16


Hello

I'm wondering if this can be done.??

Currently a search of a newbb forum will search every post, meaning in the search results you can click on the first few results and they all just take you to the same thread.

I think in most cases this can be a liitle annoying for users.

Is there a way to hack the search feature of newbb so that it only returns one topic once?

thanks a lot!



35
BigJim
Re: Can't make changes to the search function - help needed!
  • 2008/6/3 1:06

  • BigJim

  • Just popping in

  • Posts: 78

  • Since: 2007/7/16


Hey trabis

I was looking to allow users to choose how they order the results (by A to Z, by hits, by date) but results would still display grouped by category. So if it was 'by hits' the category with the most hits would display all its matches first.

But actually the way you mention is so much simpler I think I'll go with that

thanks!!!!!



36
BigJim
Re: Can't make changes to the search function - help needed!
  • 2008/5/31 10:24

  • BigJim

  • Just popping in

  • Posts: 78

  • Since: 2007/7/16


Great! Thanks again trabis

Can I ask one more question?

I'm trying to have the results display grouped by categories.

The categories of the module are various countries.

So a search results will show all the matches in country 1, followed by all matches in country 2 and so on.

Any chance you can tell me how to do this???



37
BigJim
Re: Can't make changes to the search function - help needed!
  • 2008/5/30 3:27

  • BigJim

  • Just popping in

  • Posts: 78

  • Since: 2007/7/16


Brilliant that totally did it!

Thank you so much trabis!!!!!

Btw, can you tell me why this fixed, it seems the '0' is the value for $uid (is that right?) - had I deleted it by mistake previously?

thanks again

J



38
BigJim
Re: Can't make changes to the search function - help needed!
  • 2008/5/29 3:53

  • BigJim

  • Just popping in

  • Posts: 78

  • Since: 2007/7/16


thanks a lot trabis but that hasn't done it

I've made the change to kernel/modules and here is what my search.php and search.inc.php files now look like (classifieds module)

Search.php
<?php

$xoopsOption
['pagetype'] = "search";

include 
'../../mainfile.php';
$mydirname basenamedirname__FILE__ ) ) ;
$search_lang =  '_' strtoupper$mydirname ) ;
$xmid $xoopsModule->getVar('mid');
$config_handler =& xoops_gethandler('config');
$xoopsConfigSearch =& $config_handler->getConfigsByCat(XOOPS_CONF_SEARCH);
if (
$xoopsConfigSearch['enable_search'] != 1) {
    
header("Location: '.XOOPS_URL.'modules/$mydirname/index.php");
    exit();
}
$action "search";
if (!empty(
$_GET['action'])) {
  
$action $_GET['action'];
} elseif (!empty(
$_POST['action'])) {
  
$action $_POST['action'];
}
$query "";
if (!empty(
$_GET['query'])) {
  
$query $_GET['query'];
} elseif (!empty(
$_POST['query'])) {
  
$query $_POST['query'];
}
$andor "AND";
if (!empty(
$_GET['andor'])) {
  
$andor $_GET['andor'];
} elseif (!empty(
$_POST['andor'])) {
  
$andor $_POST['andor'];
}
$mid $uid $start 0;
if ( !empty(
$_GET['mid']) ) {
  
$mid intval($_GET['mid']);
} elseif ( !empty(
$_POST['mid']) ) {
  
$mid intval($_POST['mid']);
}
if (!empty(
$_GET['uid'])) {
  
$uid intval($_GET['uid']);
} elseif (!empty(
$_POST['uid'])) {
  
$uid intval($_POST['uid']);
}

if (!empty(
$_GET['level'])) {
  
$level $_GET['level'];
} elseif (!empty(
$_POST['level'])) {
  
$level $_POST['level'];
}
if (!empty(
$_GET['start'])) {
  
$start intval($_GET['start']);
} elseif (!empty(
$_POST['start'])) {
  
$start intval($_POST['start']);
}
$queries = array();



if (
$action == "results") {
    if (
$query == "") {
         
redirect_header("search.php",1,_SR_PLZENTER);
        exit();
    }
} elseif (
$action == "showall") {
    if (
$query == "" || empty($mid)) {
        
redirect_header("search.php",1,_SR_PLZENTER);
        exit();
    }
} elseif (
$action == "showallbyuser") {
    if (empty(
$mid) || empty($uid)) {
        
redirect_header("search.php",1,_SR_PLZENTER);
        exit();
    }
}

$groups is_object($xoopsUser) ? $xoopsUser -> getGroups() : XOOPS_GROUP_ANONYMOUS;
$gperm_handler = & xoops_gethandler'groupperm' );
$available_modules $gperm_handler->getItemIds('module_read'$groups);

if (
$action == 'search') {
    include 
XOOPS_ROOT_PATH.'/header.php';
    include 
'include/searchform.php';
    
$search_form->display();
    include 
XOOPS_ROOT_PATH.'/footer.php';
    exit();
}

if ( 
$andor != "OR" && $andor != "exact" && $andor != "AND" ) {
    
$andor "AND";
}

$myts =& MyTextSanitizer::getInstance();
if (
$action != 'showallbyuser') {
    if ( 
$andor != "exact" ) {
        
$ignored_queries = array(); // holds keywords that are shorter than allowed mininum length
        
$temp_queries preg_split('/[s,]+/'$query);
        foreach (
$temp_queries as $q) {
            
$q trim($q);
            if (
strlen($q) >= $xoopsConfigSearch['keyword_min']) {
                
$queries[] = $myts->addSlashes($q);
            } else {
                
$ignored_queries[] = $myts->addSlashes($q);
            }
        }
        if (
count($queries) == 0) {
            
redirect_header('search.php'2sprintf(_SR_KEYTOOSHORT$xoopsConfigSearch['keyword_min']));
            exit();
        }
    } else {
        
$query trim($query);
        if (
strlen($query) < $xoopsConfigSearch['keyword_min']) {
            
redirect_header('search.php'2sprintf(_SR_KEYTOOSHORT$xoopsConfigSearch['keyword_min']));
            exit();
        }
        
$queries = array($myts->addSlashes($query));
    }
}
switch (
$action) {
    case 
"results":
    
$module_handler =& xoops_gethandler('module');
    
$criteria = new CriteriaCompo(new Criteria('hassearch'1));
    
$criteria->add(new Criteria('isactive'1));
    
$criteria->add(new Criteria('mid'"(".implode(','$available_modules).")"'IN'));
    
$modules =& $module_handler->getObjects($criteriatrue);
    
$mids = isset($_REQUEST['mids']) ? $_REQUEST['mids'] : array();
    if (empty(
$mids) || !is_array($mids)) {
        unset(
$mids);
        
$mids array_keys($xmid);
    }
    include 
XOOPS_ROOT_PATH."/header.php";
    


// for XOOPS 2.2.x versions
if ( file_exists("language/".$xoopsConfig['language']."/main.php") ) {
include_once(
"language/".$xoopsConfig['language']."/main.php");
} else {
include_once(
"language/english/main.php");
}
// end

    
echo "<h3>".constant($search_lang."_SEARCHRESULTS")."</h3>n";
    echo 
_SR_KEYWORDS.':';
    if (
$andor != 'exact') {
        foreach (
$queries as $q) {
            echo 
' <b>'.htmlspecialchars(stripslashes($level)).'</b>';
        }
        if (!empty(
$ignored_queries)) {
            echo 
'<br />';
            
printf(_SR_IGNOREDWORDS$xoopsConfigSearch['keyword_min']);
            foreach (
$ignored_queries as $q) {
                echo 
' <b>'.htmlspecialchars(stripslashes($q)).'</b>';
            }
        }
    } else {
        echo 
' "<b>'.htmlspecialchars(stripslashes($queries[0])).'</b>"';
    }
    echo 
'<br />';
    foreach (
$mids as $mid) {
        
$mid intval($mid);
        if ( 
in_array($mid$available_modules) ) {
            
$module =& $modules[$mid];
            
$results =& $module->search($queries$andor50$level);
            
$count count($results);
            if (!
is_array($results) || $count == 0) {
                echo 
"<p>"._SR_NOMATCH."</p>";
            } else {
                for (
$i 0$i $count$i++) {
    
        echo 
"<table width="100%" class="outer"><tr>";
        echo 
"<td width="30%">";echo "<b>".$myts->makeTboxData4Show($results[$i]['type'])."</b><br /><br />";
        echo 
"<small>";
                    
$results[$i]['uid'] = @intval($results[$i]['uid']);
                    if ( !empty(
$results[$i]['uid']) ) {
                        
$uname XoopsUser::getUnameFromId($results[$i]['uid']);
                        echo 
"&nbsp".constant($search_lang."_FROM")."<a href='".XOOPS_URL."/userinfo.php?uid=".$results[$i]['uid']."'>".$uname."</a>n";
                    }
                    echo !empty(
$results[$i]['time']) ? " ("formatTimestamp(intval($results[$i]['time'])).")" "";
                    echo 
"</small>";
                    if (isset(
$results[$i]['photo']) && $results[$i]['photo'] != "") {
                        echo 
"<a href='".$results[$i]['link']."'><img src='".$results[$i]['sphoto']."' alt='' width='100' /></a></td>&nbsp;";
                    } else {
                       
                    }
                    if (!
preg_match("/^http[s]*:///i"$results[$i]['link'])) {
                        
$results[$i]['link'] = "".$results[$i]['link'];
                    }
                    echo 
"<td width="50%">";


echo 
"<b><a href='".$results[$i]['link']."'>".$myts->makeTboxData4Show($results[$i]['title'])."</a></b><br /><br />";

if ( !
XOOPS_USE_MULTIBYTES ) {
            if (
strlen($results[$i]['desctext']) >= 14) {
                
$results[$i]['desctext'] = substr($results[$i]['desctext'],0,90)."...";
            }
        }

echo 
"".$myts->makeTboxData4Show($results[$i]['cat_desc'])."";
 


                    
           echo 
"</table><table>";
                }
                if ( 
$count >= ) {
                    
$search_url XOOPS_URL."/modules/$mydirname/search.php?query=".urlencode(stripslashes(implode(' '$queries)));
                    
$search_url .= "&mid=$mid&action=showall&andor=$andor";
                    echo 
'<br /><a href="'.htmlspecialchars($search_url).'">'._SR_SHOWALLR.'</a>';
                }
         echo
"<table>";
            }
        }
        unset(
$results);
        unset(
$module);
    }
    include 
"include/searchform.php";
    
$search_form->display();
    break;
    case 
"showall":
    case 
'showallbyuser':
    include 
XOOPS_ROOT_PATH."/header.php";

// for XOOPS 2.2.x versions
if ( file_exists("language/".$xoopsConfig['language']."/main.php") ) {
include_once(
"language/".$xoopsConfig['language']."/main.php");
} else {
include_once(
"language/english/main.php");
}
// end

    
$module_handler =& xoops_gethandler('module');
    
$module =& $module_handler->get($mid);
    
$results =& $module->search($queries$andor20$start$uid$level);
    
$count count($results);
    if (
is_array($results) && $count 0) {
        
$next_results =& $module->search($queries$andor1$start 20$uid$level);
        
$next_count count($next_results);
        
$has_next false;
        if (
is_array($next_results) && $next_count == 1) {
            
$has_next true;
        }
        echo 
"<h4>".constant($search_lang."_SEARCHRESULTS")."</h4>n";
        if (
$action == 'showall') {
            echo 
_SR_KEYWORDS.':';
            if (
$andor != 'exact') {
                foreach (
$queries as $q) {
                    echo 
' <b>'.htmlspecialchars(stripslashes($q)).'</b>';
                }
            } else {
                echo 
' "<b>'.htmlspecialchars(stripslashes($queries[0])).'</b>"';
            }
            echo 
'<br /><br />';
        }
        
//    printf(_SR_FOUND,$count);
        //    echo "<br />";
        
printf(_SR_SHOWING$start+1$start $count);
        for (
$i 0$i $count$i++) {
        echo 
"<table width="100%" class="outer"><tr>";
        echo 
"<td width="30%">";echo "<b>".$myts->makeTboxData4Show($results[$i]['type'])."</b><br /><br />"
        echo 
"<small>";
                    
$results[$i]['uid'] = @intval($results[$i]['uid']);
                    if ( !empty(
$results[$i]['uid']) ) {
                        
$uname XoopsUser::getUnameFromId($results[$i]['uid']);
                        echo 
"&nbsp;".constant($search_lang."_FROM")."<a href='".XOOPS_URL."/userinfo.php?uid=".$results[$i]['uid']."'>".$uname."</a><br />";
                    }
                    echo !empty(
$results[$i]['time']) ? " ("formatTimestamp(intval($results[$i]['time'])).")" "";
                    echo 
"</small>";
                    if (isset(
$results[$i]['photo']) && $results[$i]['photo'] != "") {
                        echo 
"<a href='".$results[$i]['link']."'><img src='".$results[$i]['sphoto']."' alt='' width='100' /></a></td>&nbsp;";
                    } else {
                       
                    }
                    if (!
preg_match("/^http[s]*:///i"$results[$i]['link'])) {
                        
$results[$i]['link'] = "".$results[$i]['link'];
                    }
                    echo 
"<td width="50%">";


echo 
"<b><a href='".$results[$i]['link']."'>".$myts->makeTboxData4Show($results[$i]['title'])."</a></b><br /><br />";

if ( !
XOOPS_USE_MULTIBYTES ) {
            if (
strlen($results[$i]['desctext']) >= 14) {
                
$results[$i]['desctext'] = substr($results[$i]['desctext'],0,90)."...";
            }
        }

echo 
"".$myts->makeTboxData4Show($results[$i]['cat_desc'])."";
 

                   
           echo 
"</table><table>";
                }
                
        echo 
'
        <table>
          <tr>
        '
;
        
$search_url XOOPS_URL."/modules/$mydirname/search.php?query=".urlencode(stripslashes(implode(' '$queries)));
        
$search_url .= "&mid=$mid&action=$action&andor=$andor";
        if (
$action=='showallbyuser') {
            
$search_url .= "&uid=$uid";
        }
        if ( 
$start ) {
            
$prev $start 20;
            echo 
'<td align="left">
            '
;
            
$search_url_prev $search_url."&start=$prev";
            echo 
'<a href="'.htmlspecialchars($search_url_prev).'">'._SR_PREVIOUS.'</a></td>
            '
;
        }
        echo 
'<td>&nbsp;&nbsp;</td>
        '
;
        if (
false != $has_next) {
            
$next $start 20;
            
$search_url_next $search_url."&start=$next";
            echo 
'<td align="right"><a href="'.htmlspecialchars($search_url_next).'">'._SR_NEXT.'</a></td>
            '
;
        }
        echo 
'
          </tr>
        </table>
        <p>
        '
;
    } else {
        echo 
'<p>'._SR_NOMATCH.'</p>';
    }
    include 
"include/searchform.php";
    
$search_form->display();
    echo 
'</p>
    '
;
    break;
}
include 
XOOPS_ROOT_PATH."/footer.php";
?>


Search.inc.php
<?php

    $mydirname 
basenamedirnamedirname__FILE__ ) ) );



function 
classifieds_search($queryarray$andor$limit$offset$userid$level){
    global 
$xoopsDB$xoopsModuleConfig$mydirname;


    
$search_lang =  '_' strtoupper$mydirname ) ;
    
    
$sql "select
l.lid,l.title,l.type,l.desctext,l.price,l.typeprice,l.date,l.usid,l.town,l.country,l.premium,p.cat_desc FROM "
.$xoopsDB->prefix("".$mydirname."_listing")." l LEFT JOIN  ".$xoopsDB->prefix("".$mydirname."_categories")." p ON l.cid=p.cid  WHERE valid='Yes' AND date<=".time()."";
    if ( 
$userid != ) {
        
$sql .= " AND l.usid=".$userid." ";
    }

//if (lid=lid)
    // because count() returns 1 even if a supplied variable
    // is not an array, we must check if $querryarray is really an array
    
if ( is_array($queryarray) && $count count($queryarray) ) {
        
$sql .= " AND ((l.title LIKE '%$queryarray[0]%' OR l.type LIKE '%$queryarray[0]%' OR l.desctext LIKE '%$queryarray[0]%'OR l.price LIKE '%$queryarray[0]%' OR l.typeprice LIKE '%$queryarray[0]%' OR l.town LIKE '%$queryarray[0]%' OR l.country LIKE '%$queryarray[0]%' )";
        for(
$i=1;$i<$count;$i++){
            
$sql .= $andor ";
            
$sql .= "(l.title LIKE '%$queryarray[$i]%' OR l.type LIKE '%$queryarray[$i]%' OR l.desctext LIKE '%$queryarray[$i]%' OR l.price LIKE '%$queryarray[$i]%' OR l.typeprice LIKE '%$queryarray[$i]%' OR l.town LIKE '%$queryarray[$i]%' OR l.country LIKE '%$queryarray[$i]%' )";
        }
        
$sql .= " ) ";
    }

    
$sql .= "AND (l.type LIKE '$level') ORDER BY premium DESC, date DESC";
    
$result $xoopsDB->query($sql,$limit,$offset);
    
$ret = array();
    
$i 0;
     while(
$myrow $xoopsDB->fetchArray($result)){
        
$ret[$i]['image'] = "images/cat/default.gif";
        
$ret[$i]['link'] = "index.php?pa=viewads&amp;lid=".$myrow['lid']."";
        
$ret[$i]['title'] = $myrow['title'];
        
$ret[$i]['type'] = $myrow['type'];
        
$ret[$i]['price'] = number_format($myrow['price'], 2"."",");
        
$ret[$i]['typeprice'] = $myrow['typeprice'];
        
$ret[$i]['town'] = $myrow['town'];
        
$ret[$i]['desctext'] = $myrow['desctext'];
        
$ret[$i]['nophoto'] = "images/nophoto.jpg";
        
$ret[$i]['cat_desc'] = $myrow['cat_desc'];
        
$ret[$i]['sphoto'] = "photo/thumbs/thumb_".$myrow['url']."";
        
$ret[$i]['time'] = $myrow['date'];
        
$ret[$i]['uid'] = $myrow['usid'];
        
$i++;
    }
    return 
$ret;
}
?>


I've tried everything and it is driving me crazy - please help!!!

thanks a lot



39
BigJim
Can't make changes to the search function - help needed!
  • 2008/5/28 12:09

  • BigJim

  • Just popping in

  • Posts: 78

  • Since: 2007/7/16


Hi there

I'm trying to adjust the search feature for a module (classifieds).

I want it to search by one additional field (called 'level').

I've added the field to the search form

Then I did GET/POST in the module/search.php page (I know this works because if I do an echo "$level" statement in search.php it displays).

But in search.inc.php I can't make the search work with this new field.

$sql .= "AND (l.type LIKE '$level')

If i enter the value directly it works

$sql .= "AND (l.type LIKE 'PGT')

But if i change it back to '$level' it doesn't work. So I guess search.inc.php can't read the value of $level

I've tried adding it to the search function in search.inc.php, like this:

function classifieds_search($queryarray, $andor, $limit, $offset, $userid, $level)

But that doesn't do it

I'm stumped, can anyone tell me how to make it work

thanks a lot for any help!!



40
BigJim
Re: theme changer and zetagenesis seem to be conflicting
  • 2008/5/4 2:30

  • BigJim

  • Just popping in

  • Posts: 78

  • Since: 2007/7/16


thanks Ronaldus

I've thought about that but I still want the homepage to have dynamic content (from module blocks) - like recent forum posts

How can I do this??




TopTop
« 1 2 3 (4) 5 6 7 8 »



Login

Who's Online

199 user(s) are online (118 user(s) are browsing Support Forums)


Members: 0


Guests: 199


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