Hi there, I just started using ExpressionEngine yesterday and for the most part have found it an absolute pleasure to use! However, I’ve run into a bit of a roadblock with a client site that I’m using this on.
Part of the brief is to have side buttons that can be told to appear on some pages but not others. The user should be able to go into the admin page, add a button, and tell it to appear on say, Home, Location and News.
My initial plan was to have a textinput field (called pages) where the user can simply type in the pages that they want it to appear on, separated by |s. This is the code I have in my template so far:
{exp:channel:entries channel="sidebutton" dynamic="no"}
{if segment_1 == '{pages}'}
<a href="http://{link}" class="side-button"><h4>{title}</h4><p>{subtitle}</a><br />
{if:else} <br />
{/if}<br />
{/exp:channel:entries}This works with a single page (the button that’s showing here has the field “pages” set to “location”), but as soon as you add any more pages to the field it stops working. This isn’t surprising, as I assume EE is parsing the field literally: as “location|vision” which obviously doesn’t match any URLs on the site.
I’m a bit stumped on this one. Is there a way to get EE to parse | as, say, bash would? (as an OR)
Or am I going about this completely the wrong way?
Thanks very much in advance!