Hot answers tagged

6

It looks like you found a bug, Sean, sorry you got bitten by it. I've reported it and posted a fix here: https://support.ellislab.com/bugs/detail/19871


4

I’ve found the solution: {switch='odd|even'} needs to be namespaced so that it switches within the context of the relationship field, like so: {staff_member_groups:staff_group_members:switch='odd|even'} Otherwise, {switch='odd|even'} is going by the larger context of the entries tag that surrounds this template. For clarity, my final block of code looks ...


4

Well, if you want a modulus operator, use a modulus operator! {if total_results % 2 != 0} </div> {/if} Maybe you can find it easier this way: {exp:channel:entries channel="bullets" dynamic="no"} {if count = 1 OR count % 2 == 1} <div class="bullets"> {/if} <div class="col-lg-6 col-sm-6"> ...


3

If you're wanting the switch tag to apply to the grid rows, then you need to prefix it with your grid field name (docs): {press_releases:switch='|||</div><div class="row">'}


3

I'd like to add that with the Modulus Operator added to EE in 2.7.1 that this can be easily achived now with the following code, based on Bootstrap 3 (example using a Grid fieldtype for the output): <div class="container"> <div class="row"> {gallery} {if gallery:index % 3 == 0 OR gallery:index != 0} </div> ...


3

Looks like I got it working. maybe this will help someone else out, or maybe someone will find an even better solution. I simply switched {if row_count != total_rows} & {if row_count == total_rows} to {if count != total_results} & {if count == total_results} so the final code in my template is: {playa_field show_future_entries="yes" ...


3

I'd likely just do it with a channel entries loop - if only to take advantage of native publish and expiry date functionality so the client can schedule the publishing and hiding of the link you're referring to with ease, particularly if there is any changing content within the feature you're describing (which could then be handled on an entry by entry basis)...


3

You can capture the entries as a Stash list and use fractions to split into parts: Setting the list: https://github.com/croxton/Stash/wiki/%7Bexp%3Astash%3Aset_list%7D#capturing-channel-entry-data Getting the list and using fractions: https://github.com/croxton/Stash/wiki/%7Bexp%3Astash%3Aget_list%7D#using-fractions-to-split-lists


2

I’ve accepted Jean’s answer above, but wanted to document my own solution. Because this particular case involved querying a single-entry channel, I simply used the status field of the entry to “turn the page on or off”, as it were. Any status that is not Open (that is, Draft or Closed) will yield zero results in my loop, so I use a no_results conditional to ...


2

Yes you could use switch also. {exp:channel:entries} <div class="wrap {switch='col-lg-4|col-lg-8'} col-sm-12 content-item"> ... </div> {/exp:channel:entries} Would output alternating containers with the correct col-lg class: <div class="wrap col-lg-4 col-sm-12 content-item"> ... </div> <div class="wrap col-lg-8 col-sm-...


1

If I follow your question correctly, the output you want is for each pair of entries to be in their own sections, with the sections alternating between white and light grey backgrounds. I'm not sure about this, because your sample code appears to list all the entries within a single pair of <section> tags. If your output does split pairs of entries ...


1

WOW! I'm an idiot. lol I read right past the lists in the docs. Thanks for a great add on and doc set Mark. ;) https://github.com/croxton/Stash/wiki/Lists {exp:stash:set_list name="mini_links" parse_tags="yes"} {mini_links} {stash:href}{mini_links:link}{/stash:href} {stash:text}{mini_links:title}{/stash:text} {/mini_links} {/exp:...


1

You'll want to upgrade Fieldpack to 2.1.1 (make sure to read installation notes!)


1

Matrix field has his own {switch} tag, so channel {switch} tag (is it what you mean by "native switch function" ?) will be not working inside Matrix pair.


1

That's because of your index.php isn't included in your language changer link. http://kanuk.com/dev/index.php/Collection/femmes/manteaux-chauds goes to: http://kanuk.com/dev/fr/Collection/femmes/manteaux-chauds which is missing the index.php element: http://kanuk.com/dev/fr/index.php/Collection/femmes/manteaux-chauds/ Either modify your htaccess so it ...


Only top voted, non community-wiki answers of a minimum length are eligible