× If you expect answers you should describe your problem and give as much information's as possible. (SQL-Structure, Template Code, Joomla Version ...) Please read this before posting: joodb.feenders.de/support.html

Subtemplates

More
6 years 2 months ago - 6 years 2 months ago #4677 by ciminternet
Subtemplates was created by ciminternet
Hi!

I have two linked tables. I wonder if is possible to use two different subtemplates, one for 'catalog-template' and one for 'single entry-template'.

Example:


Table 1:

Id
Name
Id_Country
Other fields ...


Table 2:

Id_Country
Name_Country
Other fields ...



In catalog template, I like to show only name_country field of table 2, but in single-entry catalog, I need all other fields of table 2. So, if I create subtemplate for table2 with all fields, it isn't possible to get only name_country in catalog-template.

Could you helpe me?

Thanks!
Last edit: 6 years 2 months ago by ciminternet.

Please Log in to join the conversation.

More
6 years 2 months ago - 6 years 2 months ago #4678 by Dirk
Replied by Dirk on topic Subtemplates
If you have the pro version you could create a n:1 relation.

country = Id_Country<=>Id_Country
Then you create a subtemplate with {joodb field|Name_Country} as content!

In your maintemplate you write
{joodb subtemplate|country}

See here
HERE
Last edit: 6 years 2 months ago by Dirk.

Please Log in to join the conversation.

More
6 years 2 months ago #4679 by ciminternet
Replied by ciminternet on topic Subtemplates
Thanks dirk,

Yes, I have the pro version, a n:1 relation and a subtemplate with country name. All works perfect, but if you read again my post, this is not my question.

I need two different subtemplates of the same relationship table1<=>table2. In catalog view, I only need country name, which is exactly the example you've posted me ... ok!

But, I also need a subtemplate including all fields of the countries table, in single-entry template.

So ... my question is .. could I have two different links for the same two tables, each one having a differente subtemplate definition?

Thanks!

Please Log in to join the conversation.

More
6 years 2 months ago #4680 by Dirk
Replied by Dirk on topic Subtemplates

ciminternet wrote: So ... my question is .. could I have two different links for the same two tables, each one having a differente subtemplate definition?


this should work, but remember you must define different names

Please Log in to join the conversation.

More
6 years 2 months ago #4681 by ciminternet
Replied by ciminternet on topic Subtemplates

dirk wrote: this should work, but remember you must define different names


Yes, of course! I'll try it, thanks!

Please Log in to join the conversation.

More
6 years 2 months ago #4682 by ciminternet
Replied by ciminternet on topic Subtemplates
Thanks Dirk, I've tested solution using two links whith the same two tables, and it works perfect, thanks!

I've another question about search. I'm using groupselect option in order to get a dropdown which all posible values, but field is one of the linked tables, and dropdown shows me the id of the field, it's possible to get the value instead of the id?

Thanks!

Please Log in to join the conversation.

Moderators: Dirkjoest