0

Im running into a bit of a problem,

i have two channels which are called on a single page, displaying the latest entries from each. these two channels have different fields setup for descriptions and title eg. {channel1_title} {channe2_title}.

when i call channel1 and all its fields it appears correctly, and also when i call channel 2.

when i combine them however i have a problem in calling both fields in all channels

{exp:channel:entries channel="channel1 | channel2" orderby="date" sort="des" dynamic="off"}

all channel entries for both fields are called but my problem is the channels have differences, channel2 fields are video related and channel1 are image related.

what i am trying to do is loop the src and description fields so they appear but in an if statement.

Is this the correct approach or is there another way of achieving this.

1 Answer 1

0

Try something like this:

{if channel == "Channel1"}
    show channel 1's fields
{/if}
{if channel == "Channel2"}
    show channel 2's fields
{/if}
1
  • Or {if:elseif channel == "Channel2"} for faster and cleaner code. Mar 31, 2016 at 7:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.