pepperstreet VIP
Total posts: 3,837
16 Sep 2012 18:12

(related to my uploads-field and integration topic)

Hello, I am interested in creating templates and overrides. Can you provide some detailed information about the gallery field?

Since the field itself has a lot of parameters and display modes... i am not sure what is the best approach to create something. Complete override or only field output template...?

Questions and thoughts I have in mind:

  • Should I by-pass the build-in display modes with a field override?

  • How are files stored (physically and in DB)? Which structure do uploaded files have? How to access them?

  • How to pass the image URL/location to a Script that might need:

  • How to get and pass the title and caption?

Thanks in advance.

Goal: - feed other scripts and galleries with Cobalt gallery-field images

Last Modified: 02 Mar 2014


Sergey
Total posts: 13,748
18 Sep 2012 21:29

At first lets discover the current situation problem.

We have a concept that all logic parameters are in parameters and all display parameters are in template parameters. This lead us to need to make field template parameters. So you can see them only after you have chosen the field template. But we have decided that it is tooooooo much(good). It means that template parameters are mixed with logic parameters in the field parameters.

Should I by-pass the build-in display modes with a field override?

If you make template you can by-pass.

Should I by-pass the build-in display modes with a field override?

How are files stored (physically and in DB)? Which structure do uploaded files have? How to access them?

Every upload is registered in #__js_res_files with record_id field. So you can simply get all of them by query. But you do not have to. $this->value contain list of files with all needed information.

Should I by-pass the build-in display modes with a field override?

How are files stored (physically and in DB)? Which structure do uploaded files have? How to access them?

How to pass the image URL/location to a Script that might need:

You never show original image. It always generate image to be displayed with needed size. The original is available only for download.

Should I by-pass the build-in display modes with a field override?

How are files stored (physically and in DB)? Which structure do uploaded files have? How to access them?

How to pass the image URL/location to a Script that might need:

How to get and pass the title and caption?

There in $this->value every file is an object with title, id, description, and other information


pepperstreet VIP
Total posts: 3,837
19 Sep 2012 01:31

Every upload is registered in #__js_res_files with record_id field. So you can simply get all of them by query. But you do not have to. $this->value contain list of files with all needed information.

Every upload is registered in #__js_res_files with record_id field. So you can simply get all of them by query. But you do not have to. $this->value contain list of files with all needed information.

There in $this->value every file is an object with title, id, description, and other information

I guess, I have to do another PHP and SQL course. ;-)

Would like to see some reference or examples in knowledgebase, like you did for API and templates.


Sergey
Total posts: 13,748
19 Sep 2012 04:18

Would like to see some reference or examples in knowledgebase, like you did for API and templates.

That is to wide field off application. I need example user case and more specific questions. Question like "HOw to fork with files?" are subject to small book.


pepperstreet VIP
Total posts: 3,837
10 Jun 2013 17:04

I need example user case and more specific questions.

How to check gallery field if it is empty?

i.e. If no images, than output default image or maybe custom html/link/message etc..


Sackgesicht VIP
Total posts: 1,636
10 Jun 2013 23:24

Be sure that the field is selected to output at the desired mode...

Example --> if you want to display it in a list template make sure the "Display in Intro" is checked on the field level.

Then check if there is content in the field .. (check the value (database column content) or result (generated output based on selected output template) )

Example:

<?php if(isset($item->fields_by_id[24]->result) && any additional condition if needed ):?>

 put here what you want to display if the field contains something

<?php endif;?>
Powered by Cobalt