Keyword

[SOLVED] individual position of extra fields in item.php

  • Klaus Fuchs
  • Klaus Fuchs's Avatar Topic Author
  • Offline
  • New Member
More
6 years 9 months ago #162796 by Klaus Fuchs
Hi,
I am very new in K2 and i dont have much experience in php. I need to create a item.php with extra fields. The result should be like this:
blank.fuchs-net.de/index.php/sm.html
I founr the positions where the fields should be displayed.
But how to add?
I think I need to add this in a loop:
<div class="container">
<div class="col-md-3 fb"><?php echo '<p>extra field facebook icon to click</p>'; ?> </div>
<div class="col-md-3 fb"><?php echo '<p>extra field instagram icon to click</p>'; ?> </div>
<div class="col-md-3 fb"><?php echo '<p>extra field website icon to click</p>'; ?> </div>
</div>

but where:-(

somebody can help?
If its not too much I would also pay a small fee:-)

Regards Klaus

I also need to know how ta add css:see here--> www.joomlaworks.net/forum/k2-en/47985-how-to-add-css-class-to-a-extrafield

You will never hear these phrases from us:
We can't do that | I don't know what that is | I did everything on my own | That's too early | That's too late | It's too bad we couldn't work together | Let's catch up sometime | I'm sorry, I'm too busy | That was all my idea | If our competitors don't hav

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 9 months ago #162805 by Krikor Boghossian
Replied by Krikor Boghossian on topic individual position of extra fields in item.php
You can render the value of each extrafield separately in order to have inherit a specific style/ markup.

github.com/kricore/Advanced-templating-with-K2/blob/master/_inc/cheatsheet.php#L168-L173

Just replace the alias and create your own markup (which you are halfway there).

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Klaus Fuchs
  • Klaus Fuchs's Avatar Topic Author
  • Offline
  • New Member
More
6 years 9 months ago #162820 by Klaus Fuchs
Replied by Klaus Fuchs on topic individual position of extra fields in item.php
thank you so much!
u mean it is the snippet from line 168 to 173?

As I dont know much abt. php I dont know where to add this in my item.php.

I have this extrafileds:
image_left
image_right
image_middle
goto_fb
goto_insta
goto_www


But where to add? I think I know that it has to be in a loop?!

Do u know somebody who could help me for this time, so that I understand more for the next projects? I f I see how, then I may know to solve it next tim. CSS should not be a problem, but php.. I am too old to learn some more:-)

Thanks
klaus
blank.fuchs-net.de/index.php/sm.html

You will never hear these phrases from us:
We can't do that | I don't know what that is | I did everything on my own | That's too early | That's too late | It's too bad we couldn't work together | Let's catch up sometime | I'm sorry, I'm too busy | That was all my idea | If our competitors don't hav

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

  • Klaus Fuchs
  • Klaus Fuchs's Avatar Topic Author
  • Offline
  • New Member
More
6 years 9 months ago #162826 by Klaus Fuchs
Replied by Klaus Fuchs on topic individual position of extra fields in item.php
Hi there,
I tried but I failed:-(

I add
<?php if( isset( $this->item->extraFields->goto_fb->value ) && ( $this->item->extraFields->goto_fb->value !== '') )
{ $this->item->extraFields->goto_fb->name;
$this->item->extraFields->goto_fb->value;
}
<?php endif; ?>

Where goto_fb is my extra field alias.
I placed this snippet in my item.php, but I always get this error:

SYNTAX ERROR, UNEXPECTED '<', EXPECTING END OF FILE
The page you are looking for was moved, removed, renamed or might never existed.

I understand that there is a syntax error but as mentioned before i do not have any php knowledge - just that I c an read the code:-)
Someone pls. could give me a hint?!
Thank you all for reading and helping
Klaus

You will never hear these phrases from us:
We can't do that | I don't know what that is | I did everything on my own | That's too early | That's too late | It's too bad we couldn't work together | Let's catch up sometime | I'm sorry, I'm too busy | That was all my idea | If our competitors don't hav

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

  • Klaus Fuchs
  • Klaus Fuchs's Avatar Topic Author
  • Offline
  • New Member
More
6 years 9 months ago #162828 by Klaus Fuchs
Replied by Klaus Fuchs on topic individual position of extra fields in item.php
I solved some things already, but now i have this situation
I tried hard to understand:-)

I add this code
- the first container with the three extrafields:
it does not display my extra_Fields with the alias you can see here:
Below the container I did a dump of all extra_fields, and all is ok = display all my extra fields.
U can check here: blank.fuchs-net.de/index.php/sm.html


<div class="container">
<div class="col-md-4 image">
<?php if( isset( $this->item->extra_fields->image_left ) && ( $this->item->extra_fields->image_left->value !== '') )
{ $this->item->extra_fields->image_left->name;
$this->item->extra_fields->image_left->value;}?>
</div>
<div class="col-md-4 image">
<?php if( isset( $this->item->extra_fields->image_left ) && ( $this->item->extra_fields->image_left->value !== '') )
{ $this->item->extra_fields->image_left->name;
$this->item->extra_fields->image_left->value;}?>
</div>
<div class="col-md-4 image">
<?php if( isset( $this->item->extra_fields->image_left ) && ( $this->item->extra_fields->image_left->value !== '') )
{ $this->item->extra_fields->image_left->name;
$this->item->extra_fields->image_left->value;}?>
</div>
</div>
<!-- finish three images in a container -->

<!-- dump of all extra_fields-->
<?php var_dump($this->item->extra_fields); ?>
<!-- finish dump of all extra_fields-->

Help needed!
thanks
klaus

You will never hear these phrases from us:
We can't do that | I don't know what that is | I did everything on my own | That's too early | That's too late | It's too bad we couldn't work together | Let's catch up sometime | I'm sorry, I'm too busy | That was all my idea | If our competitors don't hav

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 9 months ago #162834 by Krikor Boghossian
Replied by Krikor Boghossian on topic individual position of extra fields in item.php
Use this snippet as your starting point.
<div class="col-md-4 image">
	<?php if( isset( $this->item->extra_fields->image_left ) && ( $this->item->extra_fields->image_left->value !== '') )
	{	
		echo $this->item->extra_fields->image_left->name;
		echo $this->item->extra_fields->image_left->value;
	} ?>
</div>

Furthermore,
echo $this->item->extra_fields->image_left->name;
can be omitted.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Klaus Fuchs
  • Klaus Fuchs's Avatar Topic Author
  • Offline
  • New Member
More
6 years 9 months ago #162839 by Klaus Fuchs
Replied by Klaus Fuchs on topic individual position of extra fields in item.php
thank you so much again,

I think I did someting wrong agian, It doesnt show the extrafields even with ur snippet,
I fear I did another big mistake somewhere else!
1.) I added a extra field group called nh_layout
2.) I created a category called dummy-item-bilder
3.) This category is Associated with "nh_layout"
4.) I added an item in this category(nh_layout) and added a value for this extra fields
5.) Then I changed this file: /sub/joomla3/templates/my_template/html/com_k2/templates/nh_layout/item.php

Is there anything else i need to do and I didnt do?????
This is the snippet I added in this file:
blank.fuchs-net.de/templates/jsn_sunblank_free/html/com_k2/templates/nh_layout/item.php

<!-- three images in a container -->
<div class="container">
<div class="col-md-4 image">
<?php if( isset( $this->item->extra_fields->image_left ) && ( $this->item->extra_fields->image_left->value !== '') )
{echo $this->item->extra_fields->image_left->value;}
?>
</div>
<div class="col-md-4 image">
<?php if( isset( $this->item->extra_fields->image_middle ) && ( $this->item->extra_fields->image_middle->value !== '') )
{echo $this->item->extra_fields->image_middle->value; }
?>
</div>
<div class="col-md-4 image">
<?php if( isset( $this->item->extra_fields->image_right ) && ( $this->item->extra_fields->image_right->value !== '') )
{echo $this->item->extra_fields->image_right->value;}
?>
</div>

You will never hear these phrases from us:
We can't do that | I don't know what that is | I did everything on my own | That's too early | That's too late | It's too bad we couldn't work together | Let's catch up sometime | I'm sorry, I'm too busy | That was all my idea | If our competitors don't hav

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 9 months ago #162841 by Krikor Boghossian
Replied by Krikor Boghossian on topic individual position of extra fields in item.php
Are extrafields enabled in the category's settings?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Klaus Fuchs
  • Klaus Fuchs's Avatar Topic Author
  • Offline
  • New Member
More
6 years 9 months ago #162842 by Klaus Fuchs
Replied by Klaus Fuchs on topic individual position of extra fields in item.php
Are extrafields enabled in the category's settings?
yes, where ever in the settings there is extrafields I set it to 'show'
Do I need to change the category_item.php too, or the category.php-this 2 files I did noit touch.
I do not need to display a category, only single K2 items.
very strange, it sounds so easy, but I cannot find my mistake:-(

Klaus
Thank u for helping, I buy u a drink:-)

You will never hear these phrases from us:
We can't do that | I don't know what that is | I did everything on my own | That's too early | That's too late | It's too bad we couldn't work together | Let's catch up sometime | I'm sorry, I'm too busy | That was all my idea | If our competitors don't hav

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

  • Klaus Fuchs
  • Klaus Fuchs's Avatar Topic Author
  • Offline
  • New Member
More
6 years 9 months ago #162854 by Klaus Fuchs
Replied by Klaus Fuchs on topic individual position of extra fields in item.php
Still magic, still keep on looking for my mistake:-(
blank.fuchs-net.de/index.php/sm.html

I add the snippet, like recommended but nothing to see, everything about extra fields is enabled in the categories and the item.
just want to have it soooo simple:
image | image | image
Introtext
fulltext
www link | fb link | instagram link
nothing more.
I shortende the item.php to the minimun I need. Bit still cannot pull this extrafields:-)
If someone is out there willing to help, I would also pay a small fee ( how small u ust tell) u can get access to my development site, temp. ftp etc..
the item.php file is here to download ( as plaintext)
blank.fuchs-net.de/item.txt

Thanks to all!

Klaus = exhausted:-)

You will never hear these phrases from us:
We can't do that | I don't know what that is | I did everything on my own | That's too early | That's too late | It's too bad we couldn't work together | Let's catch up sometime | I'm sorry, I'm too busy | That was all my idea | If our competitors don't hav

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


Powered by Kunena Forum