8 – How can I inject relevant/filtered ads every 5th result in a view?

I have a view that displays filtered results of Business Offers and Events as “cards”. Now my boss wants to inject relevant custom ads into the results based on the user selected filters (basically, by city/region and business type)…

So, I created another custom content type called “Ads” with fields for multiple images (different sized ads), a click-through url, some tracking details, the type of business the ad is for (like Restaurant, or Venue, etc), and the “market location” (city/region) that the ad would be relevant to display in.

In the twig template file for this view, here are the relevant lines of code that basically inject an Ad placeholder every 5th row:

{% for row in rows %}
  {% if loop.index|trim|last == '5' or loop.index|trim|last == '0' %}
    <div class="card ad">
      <div class="ad_tag">AD</div>
      <div class="advert">ADVERTISEMENT</div>
    </div>
    {{- row.content -}}
  {% else %}
    {{- row.content -}}
  {% endif %}
  {# </div> #}
{% endfor %}

And here’s what that looks like:
Example View Result with an Ad every 5th result/row

My question is…what’s the best way to for me to grab as many unique Ads as possible that are filtered by user selected filters (location and/or business type) of the main offers view…and how can I inject these ads like I have in this twig template?

Some approaches I thought of:

  1. Have the view’s content filter simply get two content types: The original offers…AND the ads. Problem: I don’t know how to control the order of these results such that they will render 5 offers, 1 ad, 5 offers, 1 ad etc…
  2. Possibly create another view just for the Ads and somehow render only one result of this view for every 5th row of the main view Problem: I don’t know how to access and render this data via the twig template, or how to pass the filter values of the main view to the view for the ads via the twig template.
  3. Perhaps I could create a attachment view for the ads with filter values inherited from the main view, initially hide all the ads from view via css, and then use Javascript to move the ad card nodes in between the offer cards every 5th card and then set their css to display again. Problem: My page is already rife with Javascript trickery…and this will be yet another computational expense that will slow down client side responsiveness…

OR…is there a much better approach that I’m just ignorant of (which is very likely, as I only just started using Drupal 8+ this summer)?

Thanks in advance for your help.

NOTE: I realize there are several questions similar to this one, but my question is slightly unique because I’d like to use a few of the user selectable filter parameters of the main view to filter the ads that I’d like to display/inject every 5th row so they are targeted ads

dnd 5e – Do different versions of the same feats stack in 5th edition?

You can take each feat only once.

Unless the feat’s description says otherwise. PHB page 165, second paragraph of feats.

As an example of a feat that can be taken more than once in the PHB there’s Elemental Adept.

A sorcerer using the metamagic distant magic would double the range on top of the benefits of the feat, since it’s not a feat taken more than once but similar effects.

security – How safe is my Nexus 6 with Android 7.1.1 and the possible latest update (Oct 5th 2017)?

I found my old Nexus 6. No SIM in it, just connects to the Internet via my home wifi.

I’ve tried to catch the latest updates, upgrades, and security patches, then I realized, unless I doing something “big” like changing rom, or whatever it is called, which I definitely do not want, I stucked with 7.1.1 and its latest security update Oct.5th 17.

My question is it safe to use?

Nothing special sensitive there, but I would like to log in to Google Play with my account to download and by some apps

dnd 5e – How to cast 5e / 5th lvl ‘Awaken’ (spell) on ‘highly intelligent’ plants and beasts?

You will need to permanently reduce their intelligence in order for this to work as if it’s only temporary when the temporary change ends the target will become an invalid target for awaken.

I do not know of any way a PC can permanently alter the intelligence of another creature outside of wish which may come with it’s own consequences for a request like that.

Here are a couple of options.

Both of the below require giving an NPC an immensely powerful item.

Giving an artifact with major detrimental properties to the creature

The DMG has an option for DMs to give artifacts (and other magical items) beneficial and detrimental properties.

Each artifact has its own magical properties, as other magic items do, and the properties are often exceptionally powerful. An artifact might have other properties that are either beneficial or detrimental. You can choose such properties from the tables in this section or determine them randomly. You can also invent new beneficial and detrimental properties. These properties typically change each time an artifact appears in the world.

An artifact can have as many as four minor beneficial properties and two major beneficial properties. It can have as many as four minor detrimental properties and two major detrimental properties.

If you were to gain access to an artifact, and have it exhibit the following major detrimental property, then it could work:

When you become attuned to the artifact, one of your ability scores is reduced by 2 at random. A greater restoration spell restores the ability to normal.

However, you would need get an artifact and have the creature attune to it. And have either the DM provide this property or have it randomized. And you’d have to hope no one cast greater restoration on it after.

Giving a Deck of Many Things to a creature and hoping they pull the right card

Thomas Markov suggests this as another possibility with drawing the idiot card.

dnd 5e – Does the 5e / 5th lvl ‘Awaken’ spell give or create a soul?

The Awaken spell adds sentience – granting ‘intelligence’ of 10 to either one beast or plant target (one that starts with an int score of 3 or less). It also adds mobility, ambulatory function, perceptions – and even capacity to grasp an entire bonus language. It can even talk. Yet inquiring minds want to know:

Under what conditions does Awaken grant &/or create a soul – if any?


Points of Interest & Confusion

  • This Awakened target (‘huge or smaller’) may be a beast. Beasts are both ‘living’ and ‘creatures’ – but does that mean they start with a soul?

  • Not everyone gets a life force! Animated creatures such as zombies, flesh golems and spell simulacra are specifically & expressly devoid of soul.

  • Are plants even creatures to begin with? Note: a single Mirage Arcane ‘illusion’ spell makes up to one mile square of plant-life.


Why this is of interest: Night hags, Liches, various raise-style spells, magic items and many other game-rulings pivot around this soul-spirit stuff. Even role-playing wise: should a dog require Awaken in order to get to heaven, many inquiring minds (& their characters) would like to know.

dnd 5e – In 5th ed would a bard who multi-class as a life domain cleric have his bard healing spells improved?

This works.

Disciple of Life reads:

Whenever you use a spell of 1st level or higher to restore hit points to a creature, the creature regains additional hit points equal to 2 + the spell’s level.

The only eligibility condition for this ability to apply is that you “use a spell of 1st level or higher that restores hit points to a creature”. So your Bard spells will qualify.

To contrast, here is an example of a Cleric ability that modifies only cleric spells, the Death Domain’s Inescapable Destruction:

Starting at 6th level, the cleric’s ability to channel negative energy becomes more potent. Necrotic damage dealt by the character’s cleric spells and Channel Divinity options ignores resistance to necrotic damage.

Here we see that when the rules intend for an ability to work only on a particular class’s spells, they specify particularly which class’s spells.

dnd 5e – Are there rules for giving a sidekick spellcaster with a clerical flavour concept of prepared spells in D&D 5th edition?

Are there rules for giving a sidekick spellcaster with a clerical flavour a class and class abilities, like more prepared and known spells, closer to those of a PC in D&D 5th edition?

Сan Acolyte or the same Spellcaster Sidekick with clerical flavour know more spells than they do according to the “known spells” in Unearthed Arcana (UA) description? As much as Cleric: prepares a lot uses a little.

In particular, Acolyte has a class of Spellcaster, at the start he has a list of known spells (3 of the 1st level) and slots (3 of the 1st level), but the Cleric with the same abilities and with the 2nd level (according to UA) must have 6 prepared spells and 3 1st level slots.

If I have 2 actions per turn can I cast 2 spells? (ranger 5th level)

If I have 2 actions per turn can I cast 2 spells? (ranger halfling 5th level)

There’s a question in my party if someone can cast 2 spells during a turn if they have 2 actions (ranger 5th level class feature). There’s info online that says you can’t cast 2 spells in one turn, but it seems to mostly be discussing bonus actions and reactions (and not taking the ranger feature into account). But can I cast one spell for each action if the casting time of each spell is 1 action?

If yes, another question… if I cast a spell that requires concentration (like fog cloud) with my first action, can I then cast another spell with my second action (like cure wounds or pass without a trace)?

Thanks!!

dnd 5e – Willingness of the protection against evil spell 5th

So we encountered a situation: a possessed child. Against which I tried to do protection against evil so the child could fight the possession by having advantage.

( old game already already had a DM ruling which is fine)

But it made me question about the willingness of the target.

If they are already possessed, obviously the spirit doesn’t agree to it. So how you get the advantage against the possession if you are already possessed?

security – WordPress Traffic Being Forwarded By Hack for the 5th TIME! How to fix this (I’ve Identified the code)

My wordpress website keeps getting its traffic HIJACKED! This is the 5th time already.

The code forwarding my visitors to spam is this:

<link rel='https://api.w.org/' href='https://train.developfirstline.com/b.js?v=lp/wp-json/' /><link rel="alternate" type="application/json+oembed" href="https://train.developfirstline.com/b.js?v=lp%2Fwp-json%2Foembed%2F1.0%2Fembed&#038;url=https%3A%2F%2Ftrain.developfirstline.com%2Fb.js%3Fv%3Dlp%2F" /><link rel="alternate" type="text/xml+oembed" href="https://train.developfirstline.com/b.js?v=lp%2Fwp-json%2Foembed%2F1.0%2Fembed&#038;url=https%3A%2F%2Ftrain.developfirstline.com%2Fb.js%3Fv%3Dlp%2F&#038;format=xml" /> 

The portal’s homepage URL is: https://www.melhoramiga.com.br/

If you click on any link it shoots a sequence of redirects which lands on a fake spam page.

Can anyone help?