I’m trying to pull a value from an entry in one EE channel, make it a PHP var and reuse the value to limit the returns in a different EE channel.
{exp:channel:entries channel="publications_lancaster_current_pages"}
<?php
$theYear = "{subpage_year}";
?>
{/exp:channel:entries}
<ul>
{exp:channel:entries channel="publications_lancaster_current_entries" dynamic="no" search:article_year="<?php echo $theYear; ?>"}
<li><a href="http://{title_permalink=publications/listing_lancaster_current}">{title}</a></li>
{/exp:channel:entries}
</ul>PHP is turned on for the template and set to Input and is working fine.
The problem is that the way I’ve declared the var is as a literal “{subpage_year}”, which works OK only within its original channel:entries tags. If I try to use the EE tag without the quotes to set the var, I get a PHP error.
How can I get the value of {subpage_year} and use it in a different channel?
Maybe there’s a way to do this without PHP?