First of all, congratulations for your work and support. I installed CC V5 in the sub folder of my website. My challenge is to create a table that references two as you can see here:
http://www.stefaniamoscato.it/scuolaweb/albo-pretorio
To Model1 (Article) no problem. But when I try to call up the table "nuvrj_attachments" with Model2 (Allegati), there is a mistake and I do not understand what it is.
Seeking a solution for almost a week, I read in the forums, but can not find an explanation. Can you tell me where am I wrong?
[attachment=0]Scuola Magenta - Amministrazione 2014-06-16 13-21-06.png[/attachment]
[attachment=1]Scuola Magenta - Amministrazione 2014-06-16 13-24-17.png[/attachment]
http://www.stefaniamoscato.it/scuolaweb/albo-pretorio
To Model1 (Article) no problem. But when I try to call up the table "nuvrj_attachments" with Model2 (Allegati), there is a mistake and I do not understand what it is.
Seeking a solution for almost a week, I read in the forums, but can not find an explanation. Can you tell me where am I wrong?
[attachment=0]Scuola Magenta - Amministrazione 2014-06-16 13-21-06.png[/attachment]
[attachment=1]Scuola Magenta - Amministrazione 2014-06-16 13-24-17.png[/attachment]
252 views and no response? if I did not express well, I ask you to tell me and I will try to explain better (sorry but English is not my native language).
Hi Stefani@,
I'm afraid that you need Max for this. I haven't yet worked out how to join tables in CCV5 - particularly with
'HasMany' relationships.
I suggest that you use the Contact Us menu above to send him a message linking to this thread.
Bob
I'm afraid that you need Max for this. I haven't yet worked out how to join tables in CCV5 - particularly with
'HasMany' relationships.
I suggest that you use the Contact Us menu above to send him a message linking to this thread.
Bob
Hi,
Please clear the fields boxes in both models then enable the debug under the front or admin list, then copy and paste the debug info you get in the list page here or post a screenshot!
Regards,
Max
Please clear the fields boxes in both models then enable the debug under the front or admin list, then copy and paste the debug info you get in the list page here or post a screenshot!
Regards,
Max
Hello Max, here it is:
Array
(
[0] => SELECT `Extension`.`id` AS `Extension.id`, `Extension`.`name` AS `Extension.name` FROM `nuvrj_chronoengine_extensions` AS `Extension` WHERE `Extension`.`enabled` = '1' ORDER BY `Extension`.`ordering` ASC
[1] => SELECT `Connection`.`id` AS `Connection.id`, `Connection`.`title` AS `Connection.title`, `Connection`.`params` AS `Connection.params`, `Connection`.`extras` AS `Connection.extras`, `Connection`.`published` AS `Connection.published` FROM `nuvrj_chronoengine_connections` AS `Connection` WHERE `Connection`.`title` = 'Article' AND `Connection`.`published` = '1'
[2] => SELECT COUNT(*) AS `Article.count` FROM `nuvrj_content` AS `Article` WHERE `Article`.`state` = 1 AND `Article`.`catid` >= 23 AND `Article`.`catid` <= 27
[3] => SELECT `Article`.`id` AS `Article.id`, `Article`.`asset_id` AS `Article.asset_id`, `Article`.`title` AS `Article.title`, `Article`.`alias` AS `Article.alias`, `Article`.`title_alias` AS `Article.title_alias`, `Article`.`introtext` AS `Article.introtext`, `Article`.`fulltext` AS `Article.fulltext`, `Article`.`state` AS `Article.state`, `Article`.`sectionid` AS `Article.sectionid`, `Article`.`mask` AS `Article.mask`, `Article`.`catid` AS `Article.catid`, `Article`.`created` AS `Article.created`, `Article`.`created_by` AS `Article.created_by`, `Article`.`created_by_alias` AS `Article.created_by_alias`, `Article`.`modified` AS `Article.modified`, `Article`.`modified_by` AS `Article.modified_by`, `Article`.`checked_out` AS `Article.checked_out`, `Article`.`checked_out_time` AS `Article.checked_out_time`, `Article`.`publish_up` AS `Article.publish_up`, `Article`.`publish_down` AS `Article.publish_down`, `Article`.`images` AS `Article.images`, `Article`.`urls` AS `Article.urls`, `Article`.`attribs` AS `Article.attribs`, `Article`.`version` AS `Article.version`, `Article`.`parentid` AS `Article.parentid`, `Article`.`ordering` AS `Article.ordering`, `Article`.`metakey` AS `Article.metakey`, `Article`.`metadesc` AS `Article.metadesc`, `Article`.`access` AS `Article.access`, `Article`.`hits` AS `Article.hits`, `Article`.`metadata` AS `Article.metadata`, `Article`.`featured` AS `Article.featured`, `Article`.`language` AS `Article.language`, `Article`.`xreference` AS `Article.xreference` FROM `nuvrj_content` AS `Article` WHERE `Article`.`state` = 1 AND `Article`.`catid` >= 23 AND `Article`.`catid` <= 27 LIMIT 30
)
Array
(
[0] => SELECT `Extension`.`id` AS `Extension.id`, `Extension`.`name` AS `Extension.name` FROM `nuvrj_chronoengine_extensions` AS `Extension` WHERE `Extension`.`enabled` = '1' ORDER BY `Extension`.`ordering` ASC
[1] => SELECT `Connection`.`id` AS `Connection.id`, `Connection`.`title` AS `Connection.title`, `Connection`.`params` AS `Connection.params`, `Connection`.`extras` AS `Connection.extras`, `Connection`.`published` AS `Connection.published` FROM `nuvrj_chronoengine_connections` AS `Connection` WHERE `Connection`.`title` = 'Article' AND `Connection`.`published` = '1'
[2] => SELECT COUNT(*) AS `Article.count` FROM `nuvrj_content` AS `Article` WHERE `Article`.`state` = 1 AND `Article`.`catid` >= 23 AND `Article`.`catid` <= 27
[3] => SELECT `Article`.`id` AS `Article.id`, `Article`.`asset_id` AS `Article.asset_id`, `Article`.`title` AS `Article.title`, `Article`.`alias` AS `Article.alias`, `Article`.`title_alias` AS `Article.title_alias`, `Article`.`introtext` AS `Article.introtext`, `Article`.`fulltext` AS `Article.fulltext`, `Article`.`state` AS `Article.state`, `Article`.`sectionid` AS `Article.sectionid`, `Article`.`mask` AS `Article.mask`, `Article`.`catid` AS `Article.catid`, `Article`.`created` AS `Article.created`, `Article`.`created_by` AS `Article.created_by`, `Article`.`created_by_alias` AS `Article.created_by_alias`, `Article`.`modified` AS `Article.modified`, `Article`.`modified_by` AS `Article.modified_by`, `Article`.`checked_out` AS `Article.checked_out`, `Article`.`checked_out_time` AS `Article.checked_out_time`, `Article`.`publish_up` AS `Article.publish_up`, `Article`.`publish_down` AS `Article.publish_down`, `Article`.`images` AS `Article.images`, `Article`.`urls` AS `Article.urls`, `Article`.`attribs` AS `Article.attribs`, `Article`.`version` AS `Article.version`, `Article`.`parentid` AS `Article.parentid`, `Article`.`ordering` AS `Article.ordering`, `Article`.`metakey` AS `Article.metakey`, `Article`.`metadesc` AS `Article.metadesc`, `Article`.`access` AS `Article.access`, `Article`.`hits` AS `Article.hits`, `Article`.`metadata` AS `Article.metadata`, `Article`.`featured` AS `Article.featured`, `Article`.`language` AS `Article.language`, `Article`.`xreference` AS `Article.xreference` FROM `nuvrj_content` AS `Article` WHERE `Article`.`state` = 1 AND `Article`.`catid` >= 23 AND `Article`.`catid` <= 27 LIMIT 30
)
The associated model's data is not loaded, please clear the "foreign key" field and the primary key as well, let me know if the debug changes!
Cleared...
Array
(
[0] => SELECT `Extension`.`id` AS `Extension.id`, `Extension`.`name` AS `Extension.name` FROM `nuvrj_chronoengine_extensions` AS `Extension` WHERE `Extension`.`enabled` = '1' ORDER BY `Extension`.`ordering` ASC
[1] => SELECT `Connection`.`id` AS `Connection.id`, `Connection`.`title` AS `Connection.title`, `Connection`.`params` AS `Connection.params`, `Connection`.`extras` AS `Connection.extras`, `Connection`.`published` AS `Connection.published` FROM `nuvrj_chronoengine_connections` AS `Connection` WHERE `Connection`.`title` = 'Article' AND `Connection`.`published` = '1'
[2] => DESCRIBE `nuvrj_content`
[3] => DESCRIBE `nuvrj_content`
[4] => SELECT COUNT(*) AS `Article.count` FROM `nuvrj_content` AS `Article` WHERE `Article`.`state` = 1 AND `Article`.`catid` >= 23 AND `Article`.`catid` <= 27
[5] => SELECT `Article`.`id` AS `Article.id`, `Article`.`asset_id` AS `Article.asset_id`, `Article`.`title` AS `Article.title`, `Article`.`alias` AS `Article.alias`, `Article`.`title_alias` AS `Article.title_alias`, `Article`.`introtext` AS `Article.introtext`, `Article`.`fulltext` AS `Article.fulltext`, `Article`.`state` AS `Article.state`, `Article`.`sectionid` AS `Article.sectionid`, `Article`.`mask` AS `Article.mask`, `Article`.`catid` AS `Article.catid`, `Article`.`created` AS `Article.created`, `Article`.`created_by` AS `Article.created_by`, `Article`.`created_by_alias` AS `Article.created_by_alias`, `Article`.`modified` AS `Article.modified`, `Article`.`modified_by` AS `Article.modified_by`, `Article`.`checked_out` AS `Article.checked_out`, `Article`.`checked_out_time` AS `Article.checked_out_time`, `Article`.`publish_up` AS `Article.publish_up`, `Article`.`publish_down` AS `Article.publish_down`, `Article`.`images` AS `Article.images`, `Article`.`urls` AS `Article.urls`, `Article`.`attribs` AS `Article.attribs`, `Article`.`version` AS `Article.version`, `Article`.`parentid` AS `Article.parentid`, `Article`.`ordering` AS `Article.ordering`, `Article`.`metakey` AS `Article.metakey`, `Article`.`metadesc` AS `Article.metadesc`, `Article`.`access` AS `Article.access`, `Article`.`hits` AS `Article.hits`, `Article`.`metadata` AS `Article.metadata`, `Article`.`featured` AS `Article.featured`, `Article`.`language` AS `Article.language`, `Article`.`xreference` AS `Article.xreference` FROM `nuvrj_content` AS `Article` WHERE `Article`.`state` = 1 AND `Article`.`catid` >= 23 AND `Article`.`catid` <= 27 LIMIT 30
)
Array
(
[0] => SELECT `Extension`.`id` AS `Extension.id`, `Extension`.`name` AS `Extension.name` FROM `nuvrj_chronoengine_extensions` AS `Extension` WHERE `Extension`.`enabled` = '1' ORDER BY `Extension`.`ordering` ASC
[1] => SELECT `Connection`.`id` AS `Connection.id`, `Connection`.`title` AS `Connection.title`, `Connection`.`params` AS `Connection.params`, `Connection`.`extras` AS `Connection.extras`, `Connection`.`published` AS `Connection.published` FROM `nuvrj_chronoengine_connections` AS `Connection` WHERE `Connection`.`title` = 'Article' AND `Connection`.`published` = '1'
[2] => DESCRIBE `nuvrj_content`
[3] => DESCRIBE `nuvrj_content`
[4] => SELECT COUNT(*) AS `Article.count` FROM `nuvrj_content` AS `Article` WHERE `Article`.`state` = 1 AND `Article`.`catid` >= 23 AND `Article`.`catid` <= 27
[5] => SELECT `Article`.`id` AS `Article.id`, `Article`.`asset_id` AS `Article.asset_id`, `Article`.`title` AS `Article.title`, `Article`.`alias` AS `Article.alias`, `Article`.`title_alias` AS `Article.title_alias`, `Article`.`introtext` AS `Article.introtext`, `Article`.`fulltext` AS `Article.fulltext`, `Article`.`state` AS `Article.state`, `Article`.`sectionid` AS `Article.sectionid`, `Article`.`mask` AS `Article.mask`, `Article`.`catid` AS `Article.catid`, `Article`.`created` AS `Article.created`, `Article`.`created_by` AS `Article.created_by`, `Article`.`created_by_alias` AS `Article.created_by_alias`, `Article`.`modified` AS `Article.modified`, `Article`.`modified_by` AS `Article.modified_by`, `Article`.`checked_out` AS `Article.checked_out`, `Article`.`checked_out_time` AS `Article.checked_out_time`, `Article`.`publish_up` AS `Article.publish_up`, `Article`.`publish_down` AS `Article.publish_down`, `Article`.`images` AS `Article.images`, `Article`.`urls` AS `Article.urls`, `Article`.`attribs` AS `Article.attribs`, `Article`.`version` AS `Article.version`, `Article`.`parentid` AS `Article.parentid`, `Article`.`ordering` AS `Article.ordering`, `Article`.`metakey` AS `Article.metakey`, `Article`.`metadesc` AS `Article.metadesc`, `Article`.`access` AS `Article.access`, `Article`.`hits` AS `Article.hits`, `Article`.`metadata` AS `Article.metadata`, `Article`.`featured` AS `Article.featured`, `Article`.`language` AS `Article.language`, `Article`.`xreference` AS `Article.xreference` FROM `nuvrj_content` AS `Article` WHERE `Article`.`state` = 1 AND `Article`.`catid` >= 23 AND `Article`.`catid` <= 27 LIMIT 30
)
its still not loaded for some reason, please try to change the relation type to "hasOne" ?
Array
(
[0] => SELECT `Extension`.`id` AS `Extension.id`, `Extension`.`name` AS `Extension.name` FROM `nuvrj_chronoengine_extensions` AS `Extension` WHERE `Extension`.`enabled` = '1' ORDER BY `Extension`.`ordering` ASC
[1] => SELECT `Connection`.`id` AS `Connection.id`, `Connection`.`title` AS `Connection.title`, `Connection`.`params` AS `Connection.params`, `Connection`.`extras` AS `Connection.extras`, `Connection`.`published` AS `Connection.published` FROM `nuvrj_chronoengine_connections` AS `Connection` WHERE `Connection`.`title` = 'Article' AND `Connection`.`published` = '1'
[2] => SELECT COUNT(*) AS `Article.count` FROM `nuvrj_content` AS `Article` LEFT JOIN `nuvrj_attachments` AS `Allegati` ON `Article`.`id` = `Allegati`.`parent_id` WHERE `Article`.`state` = 1 AND `Article`.`catid` >= 23 AND `Article`.`catid` <= 27 GROUP BY `Article`.`id`
[3] => SELECT `Article`.`id` AS `Article.id`, `Article`.`asset_id` AS `Article.asset_id`, `Article`.`title` AS `Article.title`, `Article`.`alias` AS `Article.alias`, `Article`.`title_alias` AS `Article.title_alias`, `Article`.`introtext` AS `Article.introtext`, `Article`.`fulltext` AS `Article.fulltext`, `Article`.`state` AS `Article.state`, `Article`.`sectionid` AS `Article.sectionid`, `Article`.`mask` AS `Article.mask`, `Article`.`catid` AS `Article.catid`, `Article`.`created` AS `Article.created`, `Article`.`created_by` AS `Article.created_by`, `Article`.`created_by_alias` AS `Article.created_by_alias`, `Article`.`modified` AS `Article.modified`, `Article`.`modified_by` AS `Article.modified_by`, `Article`.`checked_out` AS `Article.checked_out`, `Article`.`checked_out_time` AS `Article.checked_out_time`, `Article`.`publish_up` AS `Article.publish_up`, `Article`.`publish_down` AS `Article.publish_down`, `Article`.`images` AS `Article.images`, `Article`.`urls` AS `Article.urls`, `Article`.`attribs` AS `Article.attribs`, `Article`.`version` AS `Article.version`, `Article`.`parentid` AS `Article.parentid`, `Article`.`ordering` AS `Article.ordering`, `Article`.`metakey` AS `Article.metakey`, `Article`.`metadesc` AS `Article.metadesc`, `Article`.`access` AS `Article.access`, `Article`.`hits` AS `Article.hits`, `Article`.`metadata` AS `Article.metadata`, `Article`.`featured` AS `Article.featured`, `Article`.`language` AS `Article.language`, `Article`.`xreference` AS `Article.xreference`, `Allegati`.`id` AS `Allegati.id`, `Allegati`.`filename` AS `Allegati.filename`, `Allegati`.`filename_sys` AS `Allegati.filename_sys`, `Allegati`.`file_type` AS `Allegati.file_type`, `Allegati`.`file_size` AS `Allegati.file_size`, `Allegati`.`url` AS `Allegati.url`, `Allegati`.`uri_type` AS `Allegati.uri_type`, `Allegati`.`url_valid` AS `Allegati.url_valid`, `Allegati`.`url_relative` AS `Allegati.url_relative`, `Allegati`.`display_name` AS `Allegati.display_name`, `Allegati`.`description` AS `Allegati.description`, `Allegati`.`icon_filename` AS `Allegati.icon_filename`, `Allegati`.`access` AS `Allegati.access`, `Allegati`.`state` AS `Allegati.state`, `Allegati`.`user_field_1` AS `Allegati.user_field_1`, `Allegati`.`user_field_2` AS `Allegati.user_field_2`, `Allegati`.`user_field_3` AS `Allegati.user_field_3`, `Allegati`.`parent_type` AS `Allegati.parent_type`, `Allegati`.`parent_entity` AS `Allegati.parent_entity`, `Allegati`.`parent_id` AS `Allegati.parent_id`, `Allegati`.`created` AS `Allegati.created`, `Allegati`.`created_by` AS `Allegati.created_by`, `Allegati`.`modified` AS `Allegati.modified`, `Allegati`.`modified_by` AS `Allegati.modified_by`, `Allegati`.`download_count` AS `Allegati.download_count` FROM `nuvrj_content` AS `Article` LEFT JOIN `nuvrj_attachments` AS `Allegati` ON `Article`.`id` = `Allegati`.`parent_id` WHERE `Article`.`state` = 1 AND `Article`.`catid` >= 23 AND `Article`.`catid` <= 27 GROUP BY `Article`.`id` LIMIT 30
)
(
[0] => SELECT `Extension`.`id` AS `Extension.id`, `Extension`.`name` AS `Extension.name` FROM `nuvrj_chronoengine_extensions` AS `Extension` WHERE `Extension`.`enabled` = '1' ORDER BY `Extension`.`ordering` ASC
[1] => SELECT `Connection`.`id` AS `Connection.id`, `Connection`.`title` AS `Connection.title`, `Connection`.`params` AS `Connection.params`, `Connection`.`extras` AS `Connection.extras`, `Connection`.`published` AS `Connection.published` FROM `nuvrj_chronoengine_connections` AS `Connection` WHERE `Connection`.`title` = 'Article' AND `Connection`.`published` = '1'
[2] => SELECT COUNT(*) AS `Article.count` FROM `nuvrj_content` AS `Article` LEFT JOIN `nuvrj_attachments` AS `Allegati` ON `Article`.`id` = `Allegati`.`parent_id` WHERE `Article`.`state` = 1 AND `Article`.`catid` >= 23 AND `Article`.`catid` <= 27 GROUP BY `Article`.`id`
[3] => SELECT `Article`.`id` AS `Article.id`, `Article`.`asset_id` AS `Article.asset_id`, `Article`.`title` AS `Article.title`, `Article`.`alias` AS `Article.alias`, `Article`.`title_alias` AS `Article.title_alias`, `Article`.`introtext` AS `Article.introtext`, `Article`.`fulltext` AS `Article.fulltext`, `Article`.`state` AS `Article.state`, `Article`.`sectionid` AS `Article.sectionid`, `Article`.`mask` AS `Article.mask`, `Article`.`catid` AS `Article.catid`, `Article`.`created` AS `Article.created`, `Article`.`created_by` AS `Article.created_by`, `Article`.`created_by_alias` AS `Article.created_by_alias`, `Article`.`modified` AS `Article.modified`, `Article`.`modified_by` AS `Article.modified_by`, `Article`.`checked_out` AS `Article.checked_out`, `Article`.`checked_out_time` AS `Article.checked_out_time`, `Article`.`publish_up` AS `Article.publish_up`, `Article`.`publish_down` AS `Article.publish_down`, `Article`.`images` AS `Article.images`, `Article`.`urls` AS `Article.urls`, `Article`.`attribs` AS `Article.attribs`, `Article`.`version` AS `Article.version`, `Article`.`parentid` AS `Article.parentid`, `Article`.`ordering` AS `Article.ordering`, `Article`.`metakey` AS `Article.metakey`, `Article`.`metadesc` AS `Article.metadesc`, `Article`.`access` AS `Article.access`, `Article`.`hits` AS `Article.hits`, `Article`.`metadata` AS `Article.metadata`, `Article`.`featured` AS `Article.featured`, `Article`.`language` AS `Article.language`, `Article`.`xreference` AS `Article.xreference`, `Allegati`.`id` AS `Allegati.id`, `Allegati`.`filename` AS `Allegati.filename`, `Allegati`.`filename_sys` AS `Allegati.filename_sys`, `Allegati`.`file_type` AS `Allegati.file_type`, `Allegati`.`file_size` AS `Allegati.file_size`, `Allegati`.`url` AS `Allegati.url`, `Allegati`.`uri_type` AS `Allegati.uri_type`, `Allegati`.`url_valid` AS `Allegati.url_valid`, `Allegati`.`url_relative` AS `Allegati.url_relative`, `Allegati`.`display_name` AS `Allegati.display_name`, `Allegati`.`description` AS `Allegati.description`, `Allegati`.`icon_filename` AS `Allegati.icon_filename`, `Allegati`.`access` AS `Allegati.access`, `Allegati`.`state` AS `Allegati.state`, `Allegati`.`user_field_1` AS `Allegati.user_field_1`, `Allegati`.`user_field_2` AS `Allegati.user_field_2`, `Allegati`.`user_field_3` AS `Allegati.user_field_3`, `Allegati`.`parent_type` AS `Allegati.parent_type`, `Allegati`.`parent_entity` AS `Allegati.parent_entity`, `Allegati`.`parent_id` AS `Allegati.parent_id`, `Allegati`.`created` AS `Allegati.created`, `Allegati`.`created_by` AS `Allegati.created_by`, `Allegati`.`modified` AS `Allegati.modified`, `Allegati`.`modified_by` AS `Allegati.modified_by`, `Allegati`.`download_count` AS `Allegati.download_count` FROM `nuvrj_content` AS `Article` LEFT JOIN `nuvrj_attachments` AS `Allegati` ON `Article`.`id` = `Allegati`.`parent_id` WHERE `Article`.`state` = 1 AND `Article`.`catid` >= 23 AND `Article`.`catid` <= 27 GROUP BY `Article`.`id` LIMIT 30
)
something is happening! :o
're seeing the links?
[attachment=0]Albo pretorio on-line 2014-06-23 23-30-38.png[/attachment]
're seeing the links?
[attachment=0]Albo pretorio on-line 2014-06-23 23-30-38.png[/attachment]
Now I'm noticing something else: if there is more than one file attachment in the article, appears in the table only the first.
Sorry for the delay!
Yes, this is expected since you have set it to "hasOne", please try to change it back to hasMany, clear the "join conditions", fields, order and primary key fields!
Regards,
Max
Yes, this is expected since you have set it to "hasOne", please try to change it back to hasMany, clear the "join conditions", fields, order and primary key fields!
Regards,
Max
I tried to change theme, but in that way it doesn't give even the first attachment. What can we do? I do not know whether to give up or insist? I rely on you Max!
After clearing the fields I mentioned and changing back to "hasMany", can you see any references to "Allegati" in the debug section ?
Regards,
Max
Regards,
Max
Yes, but..
Here's the warning message:
Warning: Invalid argument supplied for foreach() in /web/htdocs/www.stefaniamoscato.it/home/scuolaweb/libraries/cegcore/libs/model.php on line 1005 Warning: Invalid argument supplied for foreach() in /web/htdocs/www.stefaniamoscato.it/home/scuolaweb/libraries/cegcore/libs/model.php on line 773 Warning: Invalid argument supplied for foreach() in /web/htdocs/www.stefaniamoscato.it/home/scuolaweb/libraries/cegcore/libs/model.php on line 773 Warning: Invalid argument supplied for foreach() in /web/htdocs/www.stefaniamoscato.it/home/scuolaweb/libraries/cegcore/libs/model.php on line 773
And here the array:
Array
(
[0] => SELECT `Extension`.`id` AS `Extension.id`, `Extension`.`name` AS `Extension.name` FROM `nuvrj_chronoengine_extensions` AS `Extension` WHERE `Extension`.`enabled` = '1' ORDER BY `Extension`.`ordering` ASC
[1] => SELECT `Connection`.`id` AS `Connection.id`, `Connection`.`title` AS `Connection.title`, `Connection`.`params` AS `Connection.params`, `Connection`.`extras` AS `Connection.extras`, `Connection`.`published` AS `Connection.published` FROM `nuvrj_chronoengine_connections` AS `Connection` WHERE `Connection`.`title` = 'Article' AND `Connection`.`published` = '1'
[2] => SELECT COUNT(*) AS `Article.count` FROM `nuvrj_content` AS `Article` WHERE `Article`.`state` = 1 AND `Article`.`catid` >= 23 AND `Article`.`catid` <= 27
[3] => SELECT `Article`.`id` AS `Article.id`, `Article`.`asset_id` AS `Article.asset_id`, `Article`.`title` AS `Article.title`, `Article`.`alias` AS `Article.alias`, `Article`.`title_alias` AS `Article.title_alias`, `Article`.`introtext` AS `Article.introtext`, `Article`.`fulltext` AS `Article.fulltext`, `Article`.`state` AS `Article.state`, `Article`.`sectionid` AS `Article.sectionid`, `Article`.`mask` AS `Article.mask`, `Article`.`catid` AS `Article.catid`, `Article`.`created` AS `Article.created`, `Article`.`created_by` AS `Article.created_by`, `Article`.`created_by_alias` AS `Article.created_by_alias`, `Article`.`modified` AS `Article.modified`, `Article`.`modified_by` AS `Article.modified_by`, `Article`.`checked_out` AS `Article.checked_out`, `Article`.`checked_out_time` AS `Article.checked_out_time`, `Article`.`publish_up` AS `Article.publish_up`, `Article`.`publish_down` AS `Article.publish_down`, `Article`.`images` AS `Article.images`, `Article`.`urls` AS `Article.urls`, `Article`.`attribs` AS `Article.attribs`, `Article`.`version` AS `Article.version`, `Article`.`parentid` AS `Article.parentid`, `Article`.`ordering` AS `Article.ordering`, `Article`.`metakey` AS `Article.metakey`, `Article`.`metadesc` AS `Article.metadesc`, `Article`.`access` AS `Article.access`, `Article`.`hits` AS `Article.hits`, `Article`.`metadata` AS `Article.metadata`, `Article`.`featured` AS `Article.featured`, `Article`.`language` AS `Article.language`, `Article`.`xreference` AS `Article.xreference` FROM `nuvrj_content` AS `Article` WHERE `Article`.`state` = 1 AND `Article`.`catid` >= 23 AND `Article`.`catid` <= 27 LIMIT 30
[4] => SELECT `Allegati`.`id` AS `Allegati.id`, `Allegati`.`filename` AS `Allegati.filename`, `Allegati`.`filename_sys` AS `Allegati.filename_sys`, `Allegati`.`file_type` AS `Allegati.file_type`, `Allegati`.`file_size` AS `Allegati.file_size`, `Allegati`.`url` AS `Allegati.url`, `Allegati`.`uri_type` AS `Allegati.uri_type`, `Allegati`.`url_valid` AS `Allegati.url_valid`, `Allegati`.`url_relative` AS `Allegati.url_relative`, `Allegati`.`display_name` AS `Allegati.display_name`, `Allegati`.`description` AS `Allegati.description`, `Allegati`.`icon_filename` AS `Allegati.icon_filename`, `Allegati`.`access` AS `Allegati.access`, `Allegati`.`state` AS `Allegati.state`, `Allegati`.`user_field_1` AS `Allegati.user_field_1`, `Allegati`.`user_field_2` AS `Allegati.user_field_2`, `Allegati`.`user_field_3` AS `Allegati.user_field_3`, `Allegati`.`parent_type` AS `Allegati.parent_type`, `Allegati`.`parent_entity` AS `Allegati.parent_entity`, `Allegati`.`parent_id` AS `Allegati.parent_id`, `Allegati`.`created` AS `Allegati.created`, `Allegati`.`created_by` AS `Allegati.created_by`, `Allegati`.`modified` AS `Allegati.modified`, `Allegati`.`modified_by` AS `Allegati.modified_by`, `Allegati`.`download_count` AS `Allegati.download_count` FROM `nuvrj_attachments` AS `Allegati` WHERE `Allegati`.`article_id` IN ('27', '28', '68')
)
Here's the warning message:
Warning: Invalid argument supplied for foreach() in /web/htdocs/www.stefaniamoscato.it/home/scuolaweb/libraries/cegcore/libs/model.php on line 1005 Warning: Invalid argument supplied for foreach() in /web/htdocs/www.stefaniamoscato.it/home/scuolaweb/libraries/cegcore/libs/model.php on line 773 Warning: Invalid argument supplied for foreach() in /web/htdocs/www.stefaniamoscato.it/home/scuolaweb/libraries/cegcore/libs/model.php on line 773 Warning: Invalid argument supplied for foreach() in /web/htdocs/www.stefaniamoscato.it/home/scuolaweb/libraries/cegcore/libs/model.php on line 773
And here the array:
Array
(
[0] => SELECT `Extension`.`id` AS `Extension.id`, `Extension`.`name` AS `Extension.name` FROM `nuvrj_chronoengine_extensions` AS `Extension` WHERE `Extension`.`enabled` = '1' ORDER BY `Extension`.`ordering` ASC
[1] => SELECT `Connection`.`id` AS `Connection.id`, `Connection`.`title` AS `Connection.title`, `Connection`.`params` AS `Connection.params`, `Connection`.`extras` AS `Connection.extras`, `Connection`.`published` AS `Connection.published` FROM `nuvrj_chronoengine_connections` AS `Connection` WHERE `Connection`.`title` = 'Article' AND `Connection`.`published` = '1'
[2] => SELECT COUNT(*) AS `Article.count` FROM `nuvrj_content` AS `Article` WHERE `Article`.`state` = 1 AND `Article`.`catid` >= 23 AND `Article`.`catid` <= 27
[3] => SELECT `Article`.`id` AS `Article.id`, `Article`.`asset_id` AS `Article.asset_id`, `Article`.`title` AS `Article.title`, `Article`.`alias` AS `Article.alias`, `Article`.`title_alias` AS `Article.title_alias`, `Article`.`introtext` AS `Article.introtext`, `Article`.`fulltext` AS `Article.fulltext`, `Article`.`state` AS `Article.state`, `Article`.`sectionid` AS `Article.sectionid`, `Article`.`mask` AS `Article.mask`, `Article`.`catid` AS `Article.catid`, `Article`.`created` AS `Article.created`, `Article`.`created_by` AS `Article.created_by`, `Article`.`created_by_alias` AS `Article.created_by_alias`, `Article`.`modified` AS `Article.modified`, `Article`.`modified_by` AS `Article.modified_by`, `Article`.`checked_out` AS `Article.checked_out`, `Article`.`checked_out_time` AS `Article.checked_out_time`, `Article`.`publish_up` AS `Article.publish_up`, `Article`.`publish_down` AS `Article.publish_down`, `Article`.`images` AS `Article.images`, `Article`.`urls` AS `Article.urls`, `Article`.`attribs` AS `Article.attribs`, `Article`.`version` AS `Article.version`, `Article`.`parentid` AS `Article.parentid`, `Article`.`ordering` AS `Article.ordering`, `Article`.`metakey` AS `Article.metakey`, `Article`.`metadesc` AS `Article.metadesc`, `Article`.`access` AS `Article.access`, `Article`.`hits` AS `Article.hits`, `Article`.`metadata` AS `Article.metadata`, `Article`.`featured` AS `Article.featured`, `Article`.`language` AS `Article.language`, `Article`.`xreference` AS `Article.xreference` FROM `nuvrj_content` AS `Article` WHERE `Article`.`state` = 1 AND `Article`.`catid` >= 23 AND `Article`.`catid` <= 27 LIMIT 30
[4] => SELECT `Allegati`.`id` AS `Allegati.id`, `Allegati`.`filename` AS `Allegati.filename`, `Allegati`.`filename_sys` AS `Allegati.filename_sys`, `Allegati`.`file_type` AS `Allegati.file_type`, `Allegati`.`file_size` AS `Allegati.file_size`, `Allegati`.`url` AS `Allegati.url`, `Allegati`.`uri_type` AS `Allegati.uri_type`, `Allegati`.`url_valid` AS `Allegati.url_valid`, `Allegati`.`url_relative` AS `Allegati.url_relative`, `Allegati`.`display_name` AS `Allegati.display_name`, `Allegati`.`description` AS `Allegati.description`, `Allegati`.`icon_filename` AS `Allegati.icon_filename`, `Allegati`.`access` AS `Allegati.access`, `Allegati`.`state` AS `Allegati.state`, `Allegati`.`user_field_1` AS `Allegati.user_field_1`, `Allegati`.`user_field_2` AS `Allegati.user_field_2`, `Allegati`.`user_field_3` AS `Allegati.user_field_3`, `Allegati`.`parent_type` AS `Allegati.parent_type`, `Allegati`.`parent_entity` AS `Allegati.parent_entity`, `Allegati`.`parent_id` AS `Allegati.parent_id`, `Allegati`.`created` AS `Allegati.created`, `Allegati`.`created_by` AS `Allegati.created_by`, `Allegati`.`modified` AS `Allegati.modified`, `Allegati`.`modified_by` AS `Allegati.modified_by`, `Allegati`.`download_count` AS `Allegati.download_count` FROM `nuvrj_attachments` AS `Allegati` WHERE `Allegati`.`article_id` IN ('27', '28', '68')
)
You are using a table list or custom list ?
Ok! in the "Columns list" please add a new column named "Allegati.data", then in the "PHP Functions" box, please add this line:
Now what do you get in this new column added to the table ?
Regards,
Max
Allegati.data:return pr($row);
Now what do you get in this new column added to the table ?
Regards,
Max
Thanks for your time! I'm sorry but I can not bring it back, it's too long. The column "Allegati.data" is empty. There are a number of Arrays, you can see it yourself
http://www.stefaniamoscato.it/scuolaweb/albo-pretorio
http://www.stefaniamoscato.it/scuolaweb/albo-pretorio
Hi Stefania,
The attachments are not loaded, under the "foreign key" field in the "Allegati" model, please enter "parent_id".
Then, go to the php function and change the line to this:
I think this should work for you!
Regards,
Max
The attachments are not loaded, under the "foreign key" field in the "Allegati" model, please enter "parent_id".
Then, go to the php function and change the line to this:
Allegati.data:return implode(",", \GCore\Libs\Arr::getVal($row, array("Allegati", "[n]", "filename"), array()));
I think this should work for you!
Regards,
Max
Now, the last thing is to create the link to the file to download it.
I tried to do the same way I did for the link to the joomla article, namely:
View linkable -> "Allegati.data"
Links -> Allegati.data:http://www.stefaniamoscato.it/scuolaweb/attachments/article/{Allegati.parent_id}/{Allegati.filename} "target=_blank"
But this time it does not work, why?
I tried to do the same way I did for the link to the joomla article, namely:
View linkable -> "Allegati.data"
Links -> Allegati.data:http://www.stefaniamoscato.it/scuolaweb/attachments/article/{Allegati.parent_id}/{Allegati.filename} "target=_blank"
But this time it does not work, why?
Please try this one instead:
Allegati.data:return implode(",", array_map(function($file){return '<a target="_blank" href="'.$file.'">'.$file.'</a>';}, \GCore\Libs\Arr::getVal($row, array("Allegati", "[n]", "filename"), array())));
Wowwwwwww!
The download files are in a subfolder, then changing your function I got:
it works great!
Thanks Max, thanks to your help I have made a good job!
The download files are in a subfolder, then changing your function I got:
Allegati.data:return implode(",", array_map(function($file){return '<a target="_blank" href="attachments/article/{Article.id}/'.$file.'">'.$file.'</a>';}, \GCore\Libs\Arr::getVal($row, array("Allegati", "[n]", "filename"), array())));
it works great!
Thanks Max, thanks to your help I have made a good job!
This topic is locked and no more replies can be posted.