We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Help with channel entries tag.

Development and Programming

eedfwChris's avatar
eedfwChris
54 posts
14 years ago
eedfwChris's avatar eedfwChris

I’m trying to pull the subdomain as a parameter for rendering a page. Here’s what I have:

<?php 
list($subdomain) = explode('.', $_SERVER['HTTP_HOST'], 2);
if ($subdomain == 'www') $subdomain = 'default';
 ?

{exp:channel:entries channel="pages" search:subdomains="foo"}

No matter what I do it loads my pages despite foo not being in the multiselect.

[Mod Edit: Moved to the Development and Programming forum]

       
Wouter Vervloet's avatar
Wouter Vervloet
758 posts
14 years ago
Wouter Vervloet's avatar Wouter Vervloet

Hi Chris,

Could you perhaps elaborate on what you’re trying to do as I can’t really figure it out by looking at you example. Also, your way of fetching the subdomain isn’t th most reliable way, because if you were to access that page without a subdomain, it would return the domainname itself…

Wouter

       
eedfwChris's avatar
eedfwChris
54 posts
14 years ago
eedfwChris's avatar eedfwChris

Hey Wouter,

We have a multiselect field that stores the subdomain. A page entry might have the pages URL /home. Entries with this URL would exist multiple times but which pages entry is loaded depends on whether it finds an entry with that subdomain in the subdomain multiselect.

Also, we force www on all of our domains so this would work. There’s a better way to do it though I’m sure.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.