Happy New Year! Here’s the situation I’m in and what I’m trying to solve - if anyone might have some ideas, I would really appreciate it.
Channel #1 is a list of “bands”. The url_title of each band also corresponds to a subdomain used on the site
Example: entry_id = 1, title “Grumpy Cats”, url_title: grumpycats entry_id = 2, title “Three Thumbs Too Many”, url_title: threethumbs
Channel #2 is a list of “songs”
Example entry_id = 11, title “Hairballs and sour mice”, which_band=(grumpy cats) entry_id = 22, title “Hitchhiking made easy”, which_band=(three thumbs too many)
If I go to:
grumpycats.example.com, I want to show entry 11
of course, if I go to
threethumbs.example.com, I want to show entry 22
I created a plugin (subdomainer) that returns the subdomain based on the current URL… but it gets parsed AFTER the channel entries tag is parsed (I even tried the parse=’inward’ directive in the plugin tag)…
{exp:subdomainer} // returns "threethumbs"This works:
{exp:channel:entries channel='songs' dynamic='no' search:band='threethumbs'}
....
{/exp:channel:entries}This does NOT work:
{exp:channel:entries channel='songs' dynamic='no' search:band='{exp:subdomainer}'}
....
{/exp:channel:entries}………..
Is there a method of generating a global variable that I can use in my templates that is parsed very early in the process (like when segment variables are parsed?). I’m doing my best to keep any PHP out of my template. I’ve got a team of designers and project managers that would like me to keep is as clean as possible in the templates themselves.
something like this:
{exp:channel:entries channel='songs' dynamic='no' search:band='{GLOBAL_SUBDOMAIN_VAR}'}
....
{/exp:channel:entries}Thanks in advance for any ideas…
Thanks for the info.
As far as I understand it, Low Variables would work if the information was static and not being gleaned from the URL (the subdomain, in particular)
I’ve got it working with my plugin as described above. I’ll leave well-enough alone and keep my eyes open for solutions with less overhead.
Thanks again for the assist.
-Mark
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.