So, I've did this to get layout:
12 years 10 months ago #122540
I am not sure where you want to render the image path but i guess if you include this:
will give you the correct link to the image. If you need to include the href attribute on the img tag try this:
Is this what you want??
<img src="<?php echo $this->item->image; ?>" >will give you the correct link to the image. If you need to include the href attribute on the img tag try this:
<a href="some link here">
<img src=<?php echo $this->item->image ; ?></img>
</a>Is this what you want??
Didn't solve your issues?? Why dont you consider hire me? Email me or contact me www.xevedigital.com for details
Topic Author
12 years 10 months ago #122541
Olsen, I already tried that before and it does not render anything.... The $this->item->image; is not a global variable, so I can't access to it in my joomla template index.php (the file where I need to print img)... I actually tried with $jinput, nothing works... Since that k2 item has 4 different images (XS, S, L, XL), I also tried with JURI::base(), but only prints the word "IMAGE" in hash method... So, I am too messy now to think in a best solution... :side:
12 years 10 months ago #122542
But where do you want to call the image path? Isnt the K2 template?
Didn't solve your issues?? Why dont you consider hire me? Email me or contact me www.xevedigital.com for details
Topic Author
12 years 10 months ago #122543
Nop, it's in a module with php, to put the image as header.
I already tried to put it in my joomla template, getting Fatal Error in 2 ways. Fatal error: Using $this when not in object context
I already tried to put it in my joomla template, getting Fatal Error in 2 ways. Fatal error: Using $this when not in object context
12 years 10 months ago #122544
Try using the K2 Content module.
Otherwise you will have to develop a module from scratch, query the DB ... you get the picture.
Otherwise you will have to develop a module from scratch, query the DB ... you get the picture.
Topic Author
12 years 10 months ago #122545
I already tried to copy variables of mod_k2_content, nothing happened.
I guess that I have less time spended if I just turn $this->Item->image; into a global and them use it in my custom module... or just copy part of mod_k2_content helper.php to get instance. Just a litle blinded right now.
I guess that I have less time spended if I just turn $this->Item->image; into a global and them use it in my custom module... or just copy part of mod_k2_content helper.php to get instance. Just a litle blinded right now.
12 years 10 months ago #122546
Try with the default template of K2 content and only return the image.
You can choose a specific item's image as well.
Then you can override that template to fit your needs.
You can choose a specific item's image as well.
Then you can override that template to fit your needs.
Topic Author
12 years 10 months ago #122547
Yes, it's a good way to get that, sweet idea coming from heaven. :) Not what I expected, but will works nicely.
Topic Author
12 years 10 months ago #122549
After trying this way, I assume a problem: my need is to get current item image (not only show them in article like custom blogs and put it in a header). So, I really need a way to get access to variable $this->item->image.
Any idea for how could this be done? k2 content module shows ALL items (not only the current).
Any idea for how could this be done? k2 content module shows ALL items (not only the current).
12 years 10 months ago #122550
Ok. then you need a K2 plugin (It will still render in the component area but it closer to what you need).
This will get you started getk2.org/extend/extensions/90-example-k2-plugin-for-developers
This will get you started getk2.org/extend/extensions/90-example-k2-plugin-for-developers
Topic Author
12 years 10 months ago #122551
Ok, new sweet idea: set a SESSION to get $this variable. Works as '1'+'1'=11 (actually need to figure out how could this sum equals 11) :P
Firstly need to set cookie in item.php template view.
Something like:
Firstly need to set cookie in item.php template view.
Something like:
Log in or create an account to reply.