Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Jasmine

Pages: [1] 2
1
Because I can't reproduce the error and have no experience with xampp, all I can suggest is that you try adding

$catlist = '';

before the following line:

$catlist_ary = array(); // Result category list


2

I'm unable to reproduce the error.  Can you please let me know exactly what you're doing when this error appears?

3
Original post modified with your recommendation.  Thank you!

4
Above code updated to ascertain if keywords were entered before executing. 

WeZ: Did you wrap your template output tags with if ... endif conditionals?

5
V@no,  thank you for pointing that out.  I've updated the original post.  Please let me know what you think. 

I'd also like to see it honor AND OR NOT queries, but php is not my first language, and that's about the best I can do for now :) 

6
I've updated the first two lines of code.  Hope this helps.  Anyone else care to refine the code?

7
Sorry about that.  My gallery uses so many mods, that I forget which subroutines are standard and which are mods.

The get_category_path_nohtml subroutine is found in the [MOD] Dynamic Page Title for v1.7 & v1.7.1 topic.

8
Mods & Plugins (Requests & Discussions) / Re: [Mod] Search in category
« on: August 14, 2006, 05:53:27 AM »
I made a workaround for this just the other day and posted it here.

9
If I'm understanding your question correctly, the answer is addressed in this post: Search Engine Friendly URLs aka Short URLs.

10
Here's a simple solution.  I'm sure it can be optimized.  It will find all instances of a keyword or keywords in a category tree. 

Important notes:
  • The code below doesn't even think about OR, AND, or NOT queries
  • It will match ANY of the keywords entered

Examples:

In search.php, find:
Code: [Select]
//-----------------------------------------------------
//--- Show Search Results -----------------------------
//-----------------------------------------------------

add after:
Code: [Select]
// MOD: Search category names for keywords (http://www.4homepages.de/forum/index.php?topic=13675#msg75934)
   if (isset($split_words)){
      $split_words1 = preg_replace("/^\*/", '', $split_words);
      $cat_search_keywords = stripslashes(htmlspecialchars(trim(join("|", $split_words1))));        // clean up user input
      $search_cat_result = array();                                                                 // initialize array

      $resultcat = $site_db->query("SELECT cat_id FROM ".CATEGORIES_TABLE."");                      // grab all cats
      while ($row = $site_db->fetch_array($resultcat)) {                                            // loop through cats
         if ( preg_match( "/($cat_search_keywords)/i", get_category_path_nohtml( $row['cat_id'])) & // find match(es) in cat tree
              check_permission("auth_viewcat", $row['cat_id']) ){                                   // check permission
                   $search_cat_result[] = get_category_path( $row['cat_id'],1);                     // add match to array
         }
      }
      $site_db->free_result();
   }
  $site_template->register_vars( 'cat_wordsearch', (empty($search_cat_result) ? "" : join("\n\n<li>", $search_cat_result)) );      // add result to template
// END MOD: Search category names for keywords

Add in search.html:
Code: [Select]
{if cat_wordsearch}
  <h4>category title results:</h4>
  <div style="font-size: 90%;height: 100px; border: 1px dashed #47697e; overflow: auto; background-color: #D7DED1">
         <p class="text">One or more of your search criteria resulted in a match the following category names.</p>
         <ul>{cat_wordsearch}</ul>
   </div>
{endif cat_wordsearch}
Corrections and enhancements are welcome.  :)

Note:  The get_category_path_nohtml subroutine is found in the [MOD] Dynamic Page Title for v1.7 & v1.7.1 topic.

Update 2006/08/16: Added auth_viewcat and updated add match to array line per V@no's suggestion below.
Update 2006/08/20: Mod now checks to ensure that a query was entered before executing.
Update 2006/08/20: Included V@no's modification to register cat_wordsearch when no search keywords present.

11
Update:  Though it would be nice to be able to isolate the random thumbs from category thumbs, I've worked around it with a site redesign.

12
Excellent change!  For consistency, I changed that same line to:
[qcode]    array_push( $catlist_ary, get_category_path( $image_row['cat_id'], 1 ).$config['category_separator'].htmlspecialchars(stripslashes($org_search_keywords))); // Result category[/qcode]
I've updated the original post so that no one has to change the &laquo; manually -- it'll defer to the regular cat separator.

Thanks!

13
This is a quick and easy mod which displays the list of categories in which the current page's search results are found.  An example is here.

Step 1: In search.php, find
Code: [Select]
  while ($image_row = $site_db->fetch_array($result)) {
Replace with:
Code: [Select]
   $catlist_ary = array(); // Result category list

  while ($image_row = $site_db->fetch_array( $result )) {

    array_push( $catlist_ary, get_category_path( $image_row['cat_id'], 1 ).$config['category_separator'].htmlspecialchars(stripslashes($org_search_keywords))); // Result category list  

Step 2: Find:
Code: [Select]
  $content = $thumbnails;
  unset($thumbnails);

Add after:
Code: [Select]
  sort($catlist_ary); // Result category list
  $catlist = $lang['searchresult_catlist_sep'] . join($lang['searchresult_catlist_sep'], array_unique($catlist_ary)); // Result category list

Step 3: Find:
Code: [Select]
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(

Add after:
Code: [Select]
  "catlist" => $catlist, // Result category list
Step 4: In lang/yourlang/main.php, add before   ?>:
Code: [Select]
$lang['searchresult_catlist_sep'] = '<li>'; // Result category list

Step 5: Add in search.html:
Code: [Select]
{if catlist}
   <!-- Start Result category list-->
  <h4>category results:</h4>
  <div style="height: 100px; border: 1px dashed #47697e; overflow: auto;">
         <ul>{catlist}</ul>
  </div>
  <!-- End Result category list-->
{endif catlist}

Update: 2006/06/06 20:29: Included mawenzi's suggestion to include search keywords to category string.

14
Is there really no way to invoke random thumbs differently from category thumbs? (A yes or no would suffice  :lol:)

15
Hello,

I'd like to implement different link styles and thumb sizes for both the random images and the regular thumbnails lists.  In the random_image template, the only option available appears to be using {thumbnail} which already has the same link and image code as the regular thumbnails.

For example, if you look at http://www.gallery.jazzhaven.com/cat41.htm , you'll see the thumbnail listing for the category and a random image to the left.  I put a hover style on the thumbnail links which works great in the category thumbnails, but the random image  hover pushed the other content over (if a landscape pic pops up).

I've searched, but haven't found a solution.  Any help you may be able to offer will be greatly appreciated.

Best regards,
Jasmine

Pages: [1] 2