ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

nested channel entries tag. possible?

November 01, 2010 10:25pm

Subscribe [2]
  • #1 / Nov 01, 2010 10:25pm

    Cheaphotels

    12 posts

    Hi,

    here is the situation. i have a page that will show a list of entries. those specific entries have images that refer to them stored in another channel. normally in plain php or ci i do nested queries for this like

    foreach($allhotels->result_array as $rows){
    //get images based on hotel id
    $var = $this->Mymodel->getimages($rows['hotel_id']);
    
    //display hotel info and image here
    
    }

    from the sample code you can see im a ci dev but i want to take advantage of the channel system. i tried nesting the channel tags but it didnt work.

    {exp:channel:entries channel="all_hotels" limit="10"}
    
    //get image from image channel base on hotel id
    {exp:channel:entries channel="hotel_images" hotel_id="hotel_id" limit="1"}
    {/exp:channel:entries}
    
    {/exp:channel:entries}

    it this possible? how? thanks

  • #2 / Nov 02, 2010 4:15pm

    Ingmar

    29245 posts

    It’s not a very good idea, even if it works. You’re bound to run into all sorts of parse order issues and the added load is not insignificant. I would suggest to take a look at Related Entries instead.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases