Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-06-2007, 08:16 PM
kjhkjh's Avatar
kjhkjh kjhkjh is offline
 
Join Date: Jul 2005
Posts: 77
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default user specific forumhomepage

I have an idea to do something with one of my forums, just not sure how to.

Also it's pretty difficult to explain, but here goes (hope you can help)...

Am trying to have a discussion/news forum based on vBulletin for all major cities across the UK.

Would like to structure it so that the first time someone visit's the site they are asked to click the link to specify the city that they are in. (This preference will always be able to be changed from a drop down menu of cities at the top right of every page (and through static links for "view other cities" etc.)

Once they have selected their city a message will be asked to them "would you like to save this preference for future visits?". If they select yes then they automatically go through to the 'London' Page if they have selected London as their city. If they choose 'no' then they get asked for their city on every visit.

This is exactly what http://www.apple.com/uk does, when it gives you the option of UK or Ireland when you visit that link.

My first question is how is this done? I looked at their source code and still have no idea. Is it a cookie? Is it easy to do? Even with 50 options for cities? If anyone is able to explain this to me then it would be a massive help.



After this step they would then need to arrive at a forum home page which is somewhat customized for their city. There would still be mixed national news and discussion which all cities would share, but there would be forums with local forums specific to the city.

It seems like there are 2 ways to do this.

1. for me to make a page for each city (eg/ city1.domain.com) and have this as a fixed page (ie. not showing the latest topics, times of posts etc. In essence this page would just be a bunch of doors that lead to vB's true forums (bypassing the true forumhomepage). However, if after reading the forums they clicked on the forum title (which would usually take them to the forumhome) I would want them to end up back at this static page (because I want them to avoid seeing stuff for other cities unless they manually choose another city....)

This seems like it might work, so long as when they click the forum title in forum, again a cookie or whatever is read, so that the browser knows to divert the person back to city1.domain.com.

One of the downsides is that the forced forumhome (city1.domain.com) wouldn't be as dynamic as the original forumhomepage because it wouldnt change as new posts are made, with new titles and times etc... or is there a way to make this happen?

2. The second way I was thinking to do all this is after the user selects their city and chooses for the browser to 'remember' this, is to have the true forumhome do the calculations to actually display the relevant forums based on the city, and to show the national forums with all. I just have no idea on how to make this happen. All help is appreciated.

Another thing that I was thinking is not only would I want the browsers to remember the cities that the people are from (and display the relevant forums) but also for the browser to remember the people's logins - nb. this is what the usual forum home does do, but if I have to create a static page as mentionned in (1) above, then I would need to put the login box & code to remember people in there. Just have no idea to do that.

I know that this is a big roject, but some of you may be able to help with bits of it, or maybe you have used a similar thing for your forum. Maybe you're a kind soul, who s willing to help me out.

Any and all thoughts appreciated with this.

Thanks,

Matt

Anyone? I'm sure someone must have worked art-way to the above...
Reply With Quote
  #2  
Old 08-07-2007, 12:48 AM
Antivirus's Avatar
Antivirus Antivirus is offline
 
Join Date: Sep 2004
Location: Black Lagoon
Posts: 1,090
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Certainly what you're looking to do can be done, it would require custom code (I'm sure you already knew this). I imagine the city preference could easily be stored in an added column to the user table, and the content on each city page could certainly be variable as well as static. If you're looking for someone to code it, I suggest posting it in the Services Requests forum, but if you're going to try and do it yourself after reading some of the articles here, post your code you're having trouble with here and I'll see if I can help out.
Reply With Quote
  #3  
Old 08-07-2007, 01:12 AM
kjhkjh's Avatar
kjhkjh kjhkjh is offline
 
Join Date: Jul 2005
Posts: 77
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks antivirus for your reply.

I don't even think that I need to go as far as adding another column in the tables.
This is because I can see instances where people who live in, say manchester, may want to visit the london forums - (when planning a trip etc., or if they are from Newcastle but are a student in Liverpool)

So I still want freedom to travel between the cities but, I want them anchored and in a way forced to change the city.

Could you explain how the apples UK page can remember user preference (for Ireland or UK sites)?

Here is there code, and I know a bit of php which this isn't so I'm stuck!

http://registration.euro.apple.com/c...stoptionuk.cgi

Quote:
<script language="Javascript">
function expireGMT (days)
{
var now=new Date();
now.setTime (now.getTime()+days*24*3600000);
return "; expires=" + now.toGMTString()
}
function select(cc)
{
var country;
if(cc=="uk")
{
country = "(U.K.)";
}
if(cc=="ie")
{
country = "(Ireland)";
}
var answer = confirm("You just selected The Apple Store "+country+"\n\nWould you like your browser to remember this selection for future Apple Store visits?\n\nTo view Apple's privacy policy, please visit http://www.apple.com/uk/legal/privacy/");

if(answer)
{
var cookievalue = 'ukstoption='+cc+ expireGMT(90)
document.cookie = cookievalue;
}
if(cc=="uk")
{
document.location="http://www.apple.com/ukstore/";
}
if(cc=="ie")
{
document.location="http://store.apple.com/Apple/WebObjects/irlstore";
}
}
</script>
^ this bits in their head tags

and the following is in the body:

Quote:
<a href="javascript:select('ie');">Ireland</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="javascript:select('uk');">UK</a>
I guess I can't see where in this code the cookie is being set for the first time? Am I missing something from the rest of the code or does this have everything I need. (just of course have more cities and links than the 2 here)

The stuff in the head seems to check for a cookie and if one's present then do the necessary re-direct. But if there is no cookie the rest of the page is loaded and they can select the country. But after selecting UK or Ireland how is that cookie set?

Thanks for your help.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:12 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03243 seconds
  • Memory Usage 2,189KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete