Welcome, Guest
Username: Password: Remember me

TOPIC: [HOW TO] How to use a picto for link to item

How to use a picto for link to item 19 Dec 2013 15:06 #11819

  • Frederic
  • Frederic's Avatar
  • Offline
  • Senior Member
  • Posts: 56
  • Karma: 0
Hello,

I'll try to make it simple and clear...

I would like to make a link to a page (item) from a list (collection). Cook is doing that well with this code :
echo JDom::_('html.fly', array( 'dataKey' => 'descriptionField', 'dataObject' => $row,
				'route' => array('view' => 'objectitem','layout' => 'objectpageen','cid[]' => $row->id)));

My question : I would like to do the same thing with an image instead of the field's content. How could I do that ?

I already search this forum and the docs...

Thanks in advance,
Best regards,
Fred
Last Edit: 19 Dec 2013 15:13 by Frederic.
The administrator has disabled public write access.

How to use a picto for link to item 19 Dec 2013 16:04 #11820

  • etc
  • etc's Avatar
  • Offline
  • Premium Member
  • Posts: 132
  • Thank you received: 19
  • Karma: 7
Hi,

is it not the same process? If you need to display only image on sepereate page just create fly page with image and modify properties of the image in collection.
Or you need modal window so just select modal in properties of the image in collection layout.
The administrator has disabled public write access.

How to use a picto for link to item 19 Dec 2013 16:58 #11821

  • Frederic
  • Frederic's Avatar
  • Offline
  • Senior Member
  • Posts: 56
  • Karma: 0
Hi etc,

Thank you for answering. I think my question is not clear.

The code I inserted comes from a list where it generates a clickable text. On this principle, I want to build the route to link a picto in that list to target the page item.

I was searching for a documentation of JDom where I could see its regular syntax. Do you know if it has been published ?

Thansk again,
Best regards,
Fred
The administrator has disabled public write access.

How to use a picto for link to item 19 Dec 2013 18:06 #11822

  • Frederic
  • Frederic's Avatar
  • Offline
  • Senior Member
  • Posts: 56
  • Karma: 0
Here is my "dirty solution" :
<td class="tableObjectGC7">
 <div class="qqtv">
  <a href="<?php echo JURI::Base(true).'/index.php/menuName/objectitem/objectpage?cid[0]='.$row->id ?>">
   <img src='<?php echo $pathAndNameOfMyPict; ?>'>
  </a>
 </div>
</td>

I Have added this to each row of my grid. It is working fine but I am sure that there is a more pro solution...

So I am still searching a better way.

Thanks in advance,
Best regards,
Fred
The administrator has disabled public write access.

How to use a picto for link to item 19 Dec 2013 20:36 #11826

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Well, Cook encourages to access images indirecly when it is content, if it is only an icon, or something else, you can show complete path.

So
Just instance an image in your grid. It will use indirect access.
Then, simply add the 'route' array in the JDom params.
'route' => array('view' => 'objectitem','layout' => 'objectpageen','cid[]' => $row->id)

It can apply almost on all JDom calls.
This is one of the power of JDom : inheritance.

Hope it helps.
Coding is now a piece of cake
The administrator has disabled public write access.

How to use a picto for link to item 19 Dec 2013 21:23 #11827

  • Frederic
  • Frederic's Avatar
  • Offline
  • Senior Member
  • Posts: 56
  • Karma: 0
Hi Admin,

Thank you for your help.

What do you mean by "Just instance an image in your grid" ? So far, in the columns of a grid, I have been able to insert fields from the table. How can I insert an image that would not be from the table ?

Best regards,
Fred
The administrator has disabled public write access.

How to use a picto for link to item 20 Dec 2013 20:17 #11830

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
I mean your code is calling a html.fly.image JDom class.

To do that, in the builder, instance the image field. It can be behind a FK.

Regenerate and just extract the changed template file.

Note this is the way when image is dynamic. (The name is indexed in a field)

For static images, use CSS. Better.
Coding is now a piece of cake
The administrator has disabled public write access.

How to use a picto for link to item 23 Dec 2013 15:54 #11842

  • Frederic
  • Frederic's Avatar
  • Offline
  • Senior Member
  • Posts: 56
  • Karma: 0
OK. I'll try it.
Thank you !

& happy new year...

Best

Fred
The administrator has disabled public write access.
Time to create page: 0.086 seconds

Get Started