Keyword

[SOLVED] user items in columns

More
11 years 7 months ago #118286 by wone
[SOLVED] user items in columns was created by wone
Hello community!
I am trying to display user items in the user page view in tabs. Every tab representing a category. If this is not possible, i would like the items to appear in columns like in a category view.
I don't know what to do to achieve this.
Can someone help me?
Thanks

Please Log in or Create an account to join the conversation.

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
11 years 7 months ago #118287 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Re: user items in columns
It is possible, modify the user.php to display the items in columns.
I think you can display them it tabs as well.

Before doing anything, read about template overrides in the tutorials to avoid any problems in the K2 upgrade process.

Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store

Please Log in or Create an account to join the conversation.

More
11 years 7 months ago #118288 by wone
Replied by wone on topic Re: user items in columns
Thank you Mohamed. "jazakumu'Llaahu khayran"!! I'm gonna try it soon and will tell you if it worked. Thanks!!!

Please Log in or Create an account to join the conversation.

More
11 years 7 months ago #118289 by wone
Replied by wone on topic Re: user items in columns
ok i have override the template, but i don't know what to modify in the user.php file to look like the category.php file and appear like this y-designs.com/images/stories/tutorials/2013/May/3/layout.jpg
with item list primary, secondary and leading.
Thanks

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
11 years 7 months ago #118290 by Yiota
Replied by Yiota on topic Re: user items in columns
Hello wone,

The user.php doesn't have the option for Leading, Primary, etc. You will have to write the code by yourself in order to achive this. The easiest way is to choose what list/grid you want to use (1, 2, 3 or 4 columns) and make the appropriate changes in the code.

Please Log in or Create an account to join the conversation.

More
11 years 7 months ago #118291 by wone
Replied by wone on topic Re: user items in columns
Thank you , Yiota
i want to have 3 columns. But how to write this code?
some links please.
Thanks in advance!!!

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
11 years 7 months ago #118292 by Yiota
Replied by Yiota on topic Re: user items in columns
Just locate
<?php foreach ($this->items as $item): ?>

and replace it with
<?php foreach ($this->items as $countItems=>$item): ?>

Then right above the <?php endforeach; ?> add this line
<?php if (($countItems+1)%3==0) echo '<div class="clr"></div>'; ?>

Then all else will be made through CSS. Add something like this:

.userItemView {float:left;width:33.3333%;}

Please Log in or Create an account to join the conversation.

More
11 years 7 months ago #118293 by wone
Replied by wone on topic Re: user items in columns
hi again,
i have added the codes as you told me and for the css i put it here
Log in  or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
11 years 7 months ago #118294 by Yiota
Replied by Yiota on topic Re: user items in columns
Could you provide a link to your page?

Thank you.

Please Log in or Create an account to join the conversation.

More
11 years 7 months ago - 11 years 7 months ago #118295 by wone
Replied by wone on topic Re: user items in columns

Part of the message is hidden for the guests. Please log in or register to see it.

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
11 years 7 months ago #118296 by Yiota
Replied by Yiota on topic Re: user items in columns
Your code should be
<div class="userItemView" style="float:left;width:33.3333%;"<?php if(!$item->published || ($item->publish_up != $this->nullDate && $item->publish_up > $this->now) || ($item->publish_down != $this->nullDate && $item->publish_down < $this->now)) echo ' userItemViewUnpublished'; ?><?php echo ($item->featured) ? ' userItemIsFeatured' : ''; ?>">

The style should be added after the class="userItemView" closes.

Please Log in or Create an account to join the conversation.

More
11 years 7 months ago - 11 years 7 months ago #118297 by wone
Replied by wone on topic Re: user items in columns
Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
all i have to do now is to resize images to make them fit like this
Part of the message is hidden for the guests. Please log in or register to see it.
any idea? can the text be under the image? the other items are not organized too

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
11 years 7 months ago #118298 by Yiota
Replied by Yiota on topic Re: user items in columns
The user page fetches the Generic image size. If that size is different than that of your category list you can either change it in the parameters or you could change it in the user.php file.
To change it through the user.php file you need to replace the image block with the following:
<?php if($this->params->get('userItemImage') && !empty($item->imageSmall)): ?>
			  <!-- Item Image -->
			  <div class="userItemImageBlock">
				  <span class="userItemImage">
				    <a href="<?php echo $item->link; ?>" title="<?php if(!empty($item->image_caption)) echo K2HelperUtilities::cleanHtml($item->image_caption); else echo K2HelperUtilities::cleanHtml($item->title); ?>">
				    	<img src="<?php echo $item->imageSmall; ?>" alt="<?php if(!empty($item->image_caption)) echo K2HelperUtilities::cleanHtml($item->image_caption); else echo K2HelperUtilities::cleanHtml($item->title); ?>" style="width:<?php echo $this->params->get('itemImageSmall'); ?>px; height:auto;" />
				    </a>
				  </span>
				  <div class="clr"></div>
			  </div>
			  <?php endif; ?>

Please Log in or Create an account to join the conversation.

More
11 years 7 months ago #118299 by wone
Replied by wone on topic Re: user items in columns
Ok it's done!
Thaaaaank you very much!!!
But i have an unanswered question asked in this forum 6 months ago : getk2.org/community/New-to-K2-Ask-here-first/170050-sitecomuser1
can u help me for this? I have tried mijosef but i faced lot of 404 errors and i was obliged to remove it.
Thanks in advanced!!!

Please Log in or Create an account to join the conversation.

More
11 years 6 months ago #118300 by George Nasis
Replied by George Nasis on topic Re: user items in columns
i did exactly the same steps but it doesn`t work for me.. :/ any idea?

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
11 years 6 months ago #118301 by Yiota
Replied by Yiota on topic Re: user items in columns
Maybe your css is preventing the columns from actually float next to each other. Could you provide a link to your page to check it out?

Thank you.

Please Log in or Create an account to join the conversation.

More
11 years 6 months ago #118302 by George Nasis
Replied by George Nasis on topic Re: [SOLVED] user items in columns
Ok thank you very much!


Part of the message is hidden for the guests. Please log in or register to see it.

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
11 years 6 months ago #118303 by Yiota
Replied by Yiota on topic Re: [SOLVED] user items in columns
You are missing the float:left in this class div.userItemView and a <div class="clr"></div> right before the userItemList closes in the user.php file of your overrides.

Please Log in or Create an account to join the conversation.