Keyword

K2 extra field image as header in article

  • by Alexander
  • by Alexander's Avatar Topic Author
  • Offline
  • New Member
More
8 years 8 months ago - 8 years 8 months ago #150790 by by Alexander
K2 extra field image as header in article was created by by Alexander
Hi,

I want to have a custom header image for each item. By default, header articles, when using a category overview with articles and their thumbnail images, use the same image. Only the L or XL version. I want to use an extra field image where my client can choose his own image for the article header itself, not the thumbnail. That needs to stay connected to the default function like it works now.

What I did:
I made an extra field > IMAGE for a category.
I used a template from Gavick which already made their own sub template.
I copied that default folder name to my desktop, changed the name to "projects" and then uploaded it back into templates/gk_technews/html/com_k2/templates/projects"
Inside each category I changed the template for the category item layout to "projects".

once done I open item.php file from the "projects" folder. Now I see at line 64 some code that reflects the header image by default.

My question. To what do I need to change this below code to have it use the custom image selected path for a server folder? I use the following path.

/*root*/images/*clientname*/projects/

I would think that my client will need to upload each project image for his header inside this folder. When done, he can select it with the "select" button inside the K2 extra field image tab.

I'm not a php programmer. I can read it a bit, but thats about it. MAybe someone can point me out how to connect the 2. Is there a variable or something that is explicitly used for extra field images being shown?

<div class="header">
<div class="header-wrap<?php if(empty($this->item->image)) : ?> no-image<?php endif; ?>">
<?php if(!empty($this->item->image)) : ?>
<img src="<?php echo str_replace('_L.jpg', '_XL.jpg', $this->item->image); ?>" alt="<?php echo K2HelperUtilities::cleanHtml($this->item->title); ?>" />
<?php endif; ?>
Last edit: 8 years 8 months ago by by Alexander. Reason: forgot some critical information

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

  • by Alexander
  • by Alexander's Avatar Topic Author
  • Offline
  • New Member
More
8 years 8 months ago #150791 by by Alexander
Replied by by Alexander on topic K2 extra field image as header in article
Or if possible, use the first image from simple image gallery pro, but I already asked SIG support ticket for that, but they said it could not be done.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 8 months ago #150805 by Krikor Boghossian
Replied by Krikor Boghossian on topic K2 extra field image as header in article

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

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

  • by Alexander
  • by Alexander's Avatar Topic Author
  • Offline
  • New Member
More
8 years 8 months ago #150830 by by Alexander
Replied by by Alexander on topic K2 extra field image as header in article
thanks!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 8 months ago #150857 by Krikor Boghossian
Replied by Krikor Boghossian on topic K2 extra field image as header in article
You 're welcome Alexander :)

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

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


Powered by Kunena Forum