Articles Anywhere

Assign Articles Anywhere tag to php var in Sourcerer

1 month 2 weeks ago #90011

TVBZ's Avatar TVBZ

Hi,

I want to use an articles custom field value and assign it to php variable using sourcerer.
But I can't get it to work. I tried reordering the plugins and forcing content triggers. 😐

Here is the relevant part of my code, stripped to minimum:

{article}
{if downloads}
  {source 0}
  <?php $path = 'images/downloads/[downloads]'; ?>
  {/source}
{/if}
{/article}

In this scenario, I am creating a list of downloads if the article custom field "downloads" excists.
If it does, it simply contains the name of the folder to list files from..

As you can see, I am using the custom field inside the $path variable.
The php is working fine without the custom field value (simply using excisting folder name).
But how to get it work with the custom fields value?

Many thanks

1 month 2 weeks ago #90013

Peter van Westen's Avatar Peter van Westen Admin

Make sure the Articles Anywhere system plugin is ordered before Sourcerer.
See: www.regularlabs.com/blog/242-plugin-order-is-important

1 month 2 weeks ago #90014

TVBZ's Avatar TVBZ

Hi Peter.. That works! Great, thanks! 😁
Strangely I did not find it while trying the order before.