[dev] [commit] r1019 - wwwbase

Cătălin Frâncu cata at francu.com
Mon Oct 14 10:51:38 EEST 2013


Perfect! Scuze pentru întârziere.

On 10/08/2013 06:43 PM, automailer at dexonline.ro wrote:
> Author: grigoroiualex
> Date: Tue Oct  8 18:43:47 2013
> New Revision: 1019
>
> Log:
> Images are now also shown for the lexemes associated with the tags within them.
>
> Modified:
>     wwwbase/search.php
>
> Modified: wwwbase/search.php
> ==============================================================================
> --- wwwbase/search.php	Mon Oct  7 15:52:34 2013	(r1018)
> +++ wwwbase/search.php	Tue Oct  8 18:43:47 2013	(r1019)
> @@ -302,27 +302,38 @@
>
>   /* Gallery */
>   if(!empty($lexems)){
> -  $images = array(); $allTags = array(); $size = array();
> +  $images = array();
>
>     foreach($lexems as $lexeme) {
> -    $lines = Visual::get_all_by_lexemeId($lexeme->id);
> +    // Searches for images that are associated with the lexeme.
> +    $imgs = Visual::get_all_by_lexemeId($lexeme->id);
>
> -    foreach ($lines as $line) {
> -      $imgTags = array();
> +    foreach ($imgs as $img) {
> +      // For every image found, it fetches its path and its thumb path from the database
> +      $image = Visual::getImageWww($img->path);
> +      $thumb = Visual::getThumbWww($img->path);
>
> -      // For every lexeme, it fetches images and thumbs paths from the database
> -      $image = Visual::getImageWww($line->path);
> -      $thumb = Visual::getThumbWww($line->path);
> +      // and stores them in the $images array.
> +      $images[] = array('img' => $image, 'tmb' => $thumb, 'name' => $lexeme->formUtf8General,
> +                        'id' => $img->id);
> +    }
> +
> +    // Searches for tags that are associated with the lexeme.
> +    $tags = VisualTag::get_all_by_lexemeId($lexeme->id);
> +
> +    foreach ($tags as $tag) {
> +      // For every tag found, it fetches (associated) image path and its thumbnail path from database
> +      $row = Visual::get_by_id($tag->imageId);
> +      $image = Visual::getImageWww($row->path);
> +      $thumb = Visual::getThumbWww($row->path);
>
>         // and stores them in the $images array.
>         $images[] = array('img' => $image, 'tmb' => $thumb, 'name' => $lexeme->formUtf8General,
> -                        'id' => $line->id);
> +                        'id' => $row->id);
>       }
>     }
>
>     SmartyWrap::assign('images', $images);
> -  SmartyWrap::assign('tags', $allTags);
> -  SmartyWrap::assign('size', $size);
>     SmartyWrap::addCss('gallery');
>     SmartyWrap::addJs('gallery');
>   }
> _______________________________________________
> Dev mailing list
> Dev at dexonline.ro
> http://list.dexonline.ro/listinfo/dev
>


More information about the Dev mailing list