gkAvatar for k2 Categories Listing

Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.1.00 out of 6 based on 1 vote(s)
teitbite
Thu Nov 27, 2014 10:26 am
Reply with quote
Report this post
Hi

Try with adding this to override.css:

Code: Select all
.itemImageBlock {
    float: left;
    margin: 0 17px 0 0;
    max-width: 116px;
}
User avatar
Moderator

GK User
Thu Nov 27, 2014 10:45 am
Reply with quote
Report this post
I've tried it but it affects all .itemImageBlock.

What we had before, and what I need is to affect only the alternate image, meaning when there is no Image for a K2 Item, it is replaced with a K2 Avatar that has that CSS. Not all images should be affected by this CSS.


Code: Select all
/* image block for K2 avatar alternate image */
.itemImageBlock {
    float: left;
    margin: 0 17px 0 0;
    max-width: 116px;
}


I will try to make it easier for you...

We had this condition previously, it must have been put directly in a category_item.php file but now it's gone:
Code: Select all
<img src="<?php echo $this->item->author->avatar; ?>" style="float:left; padding-right:10px;" />



See post: THU OCT 30, 2014 5:57 AM

Code: Select all
<div class="itemBlock">
          <img src="<?php echo $this->item->author->avatar; ?>" style="float:left; padding-right:10px;" />
                    <?php if($this->item->params->get('catItemImage') && !empty($this->item->image)): ?>
                    <div class="itemImageBlock"> <a class="itemImage" href="<?php echo $this->item->link; ?>" title="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>">


I don't understand why this code was lost. Should I put it in an override.css file? This is PHP from what understand. I think I can prevent a similar problem if I understand the file problem.

Regards,
Alex
User avatar
Platinum Boarder

GK User
Thu Nov 27, 2014 10:54 am
Reply with quote
Report this post
OK I think I found my answer. Let me wrap my head around this...

teitbite wrote:Hi

Is the link a correct project folder ??? If yes than components/com_k2/templates/default/category_item.php is a wrong file, You need to change template's override for this file which is in templates/gk_john_s/html/com_k2/templates/default/category_item.php
User avatar
Platinum Boarder

GK User
Thu Nov 27, 2014 12:20 pm
Reply with quote
Report this post
OK I figured it out. Thank you for you patience!

Is this code OK?

Code: Select all
          <div class="itemBlock">
        <?php if(empty($this->item->image)): ?>
          <a href="<?php echo $this->item->link; ?>"> <img src="<?php echo $this->item->author->avatar; ?>" style="float:left; padding-right:10px;" /></a>
             <?php endif; ?>
User avatar
Platinum Boarder

GK User
Thu Nov 27, 2014 12:34 pm
Reply with quote
Report this post
OK, let's comeback to post WED NOV 19, 2014 11:25 AM for the gkTabs.

I would like to do the same thing with the "class="nspImage" replacing it whenever empty. Something like:

Code: Select all

          <div class="nspArtPage active nspCol1">
        <?php if(empty($this->nspArt nspCol1->nspImage)): ?>
          <a href="<?php echo $this->nspArt nspCol1->link; ?>"> <img src="<?php echo $this->nspArt nspCol1->author->avatar; ?>" style="float:left; padding-right:10px;" /></a>
             <?php endif; ?>


Does this code make sense? There are variables from both NSP and K2. Sorry I am not a programmer....

Regards.
User avatar
Platinum Boarder

teitbite
Thu Nov 27, 2014 2:06 pm
Reply with quote
Report this post
Hi

I'm afraid it will not work with NSP. Module doesn't load informations about avatar from database. I'm afraid this would require a lot of changes to the code. Try using K2 Content module instead. It's module is based on the same functions, so it should be using a very similar code.
User avatar
Moderator


cron