Best Practice?  Retrieving data based on location.
Posted: 12 June 2006 02:31 PM   [ Ignore ]  
Summer Student
Total Posts:  22
Joined  05-21-2006

Let me try to explain the scenario a little more since I think the title doesn’t do a very good job (it was the best I could come up with).  Our church currently has multiple locations which means we have multiple different sets of addresses, phone numbers, service times, etc. that need to be displayed for each location.

What we do currently is on pages with location-specific information (ex: Service Times), we display the information for all the locations.  We want to move away from this and display information based on the location the user selected once they entered our site.  So now, instead of the Service Times page containing service times for all our locations, it only contains the service times for one location.

I know EE is capable of handling this scenario, but I’m not sure how to approach this since I’m new to EE.  I’m hoping someone can direct me towards a solution.

Things that I believe need to be addressed are:

1.  How to establish the user-selected location: parameter approach (http://domain.com/index.php?location=1) or sub-directory approach (http://domain.com/1)
2.  How to setup the templates so that there is only one template for each location (makes for ease of layout changes/updates).
3.  How to access the location-specific data in the templates.  Do I put that information in templates or do I store them in weblogs?

I’m hoping to get some brainstorming here so that I have a good foundation to start with.

Thanks,
-Alex

Profile
 
 
Posted: 13 June 2006 01:35 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15343
Joined  05-15-2004

I’d use a custom field in the member data, and take it from there. Well, you could even use different member groups, and show content based on that. In your templates you would then probably use a conditional and a location-specifc embed (at least that’s how I’d go about it.)

EDIT: Actually, you’ll probably need EE Personal for that, since it relies on the Member module.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 13 June 2006 07:53 AM   [ Ignore ]   [ # 2 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  12372
Joined  04-29-2002

Do your other “locations” have their own domains? I’d use separate weblogs for each location, and based on some sort of segment stuff, display the appropriate data.

 Signature 

Quick Reference - EE Trial Options - EE Wiki - Docs for updating a build

Profile
MSG
 
 
Posted: 13 June 2006 08:16 AM   [ Ignore ]   [ # 3 ]  
Summer Student
Total Posts:  22
Joined  05-21-2006

If I understand your suggestion correctly, wouldn’t that mean a user would have to login in order to show location-specific information?  Currently, we don’t want to use this approach.  Or am I missing something?

-Alex

Ingmar - 13 June 2006 01:35 AM

I’d use a custom field in the member data, and take it from there. Well, you could even use different member groups, and show content based on that. In your templates you would then probably use a conditional and a location-specifc embed (at least that’s how I’d go about it.)

EDIT: Actually, you’ll probably need EE Personal for that, since it relies on the Member module.

Profile
 
 
Posted: 13 June 2006 08:19 AM   [ Ignore ]   [ # 4 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15343
Joined  05-15-2004

Yes, obviously. How else would you want to let EE know which template to show? You might do it with a preference setting and a cookie, but you’d have to build that on your own.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 13 June 2006 08:20 AM   [ Ignore ]   [ # 5 ]  
Summer Student
Total Posts:  22
Joined  05-21-2006

We can have subdomains (1.domain.com, 2.domain.com, etc) if that’s the best approach.  But setting up separate weblogs doesn’t require having separate domains, right?  Also, could you elaborate a little more on the “segment stuff?”  Are you referring to this: http://expressionengine.com/docs/templates/globals/url_segments.html.

So going with this idea, you would use a url similar to: http://domain.com/index.php/location1/servicetimes and then the template would get the “location1” segment and output the appropriate information in the appropriate weblog?

Thanks,
-Alex

Sue Crocker - 13 June 2006 07:53 AM

Do your other “locations” have their own domains? I’d use separate weblogs for each location, and based on some sort of segment stuff, display the appropriate data.

Profile
 
 
Posted: 13 June 2006 08:44 AM   [ Ignore ]   [ # 6 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  12372
Joined  04-29-2002

Here’s a very basic example.

I have a site called ServerGoddess. I’m creating a site for our church as well.

So I have an entry called Services in both weblogs.

Site version of Services

Church version of Services

Different templates, different data.

So for each of your locations, make a weblog. Create separate template groups for each weblog. I then have a template called info (single entry template) that would display the entry. What would change would be the weblog= value.

{assign_variable:my_weblog="cornerstone"}
{assign_variable
:my_template_group="cornerstone"}

Then use:

{exp:weblog:entries weblog="{my_weblog}" limit="1" disable="categories|member_data|pagination|trackbacks"}

For an explanation on disabling see:

Disable Parameters

 Signature 

Quick Reference - EE Trial Options - EE Wiki - Docs for updating a build

Profile
MSG
 
 
Posted: 13 June 2006 12:20 PM   [ Ignore ]   [ # 7 ]  
Summer Student
Total Posts:  22
Joined  05-21-2006

Great, thanks for the example Sue!  I just got done throwing together a working example which I think I’ll be able to build on. 

-Alex

Profile
 
 
Posted: 15 August 2008 08:58 AM   [ Ignore ]   [ # 8 ]  
Grad Student
Rank
Total Posts:  36
Joined  07-14-2008

.

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64877 Total Logged-in Users: 72
Total Topics: 81803 Total Anonymous Users: 43
Total Replies: 439748 Total Guests: 305
Total Posts: 521551    
Members ( View Memberlist )
Newest Members:  dxrsmdanbilly8hrkiliwysso50kexpressoKlaasdarrenstylestravelerjcatoncvadrata