If you are seeing this message, it is possible the page did not load properly. Please hit reload/refresh on your browser.
If you still see this message, you probably do not have a browser that supports web standards, although its content is accessible to any browser or Internet device.

Cool Tips & Tricks Cool Tips & Tricks

Help Communities:
Help Forums Bug Base
Next Topic >>
Cool Tips & Tricks ::: Javascript FAQ ::: ez URL- Determine the Board's ID, ForumID, etc. With Code
New Topic    Add Reply
Topic: ez URL- Determine the Board's ID, ForumID, etc. With Code  (?)  Click to receive email notification of replies Click to stop receiving email notification of replies email this topic to a friend
phalen180

Registered User
Posts: 220
Posted: 3/26/03 1:39 pm    
ez URL- Determine the Board's ID, ForumID, etc. With Code
UPDATED ezURL - this updated version works with the new naming structure which will come into place after the co-location move. All servers will be use the subdomain of pXX instead of bXX or pubXX. This update has NOT been made yet on individual *****s that include the ezURL, only on this master thread so far.

(updated version - should now handle all possible (modern) ezBoard URLs. has not been extensively tested, but works in IE 6 sp1 and NS 7)

Summary: Determine the board's URL with code instead of editing variables in the script. Store the other page information in variables instead of using document.location.indexOf throughout your scripts.

Details:
A lot of scripts have variables you have to change to put in your board's name or some other value which is in the URL of each board page.

A lot of scripts look at document.location.href to determine whether to do something.

For example, if you want something only on the main board page, or only on a specific forum, or only on topic pages, etc.

Most of these scripts use the method "indexOf" to determine if a particular string is contained within the current page's URL. This can be imprecise. For example, when you want to put a specific banner or other item on your "frm1" and a different specific item on your "frm11" you will run into trouble....

The solution is to use this code to deconstruct the ezboard page's URL into it's component parts:

ezPub -- what pub server are we on
ezFullPub -- full hostname of pub, i.e. pub99, beta, inbox, etc.
ezIsBoard -- am I on the main board page or a sub-page?
ezBoardID -- what is the "id" of the board?
ezForum -- what forum am I in (in the form of "frmXX")
ezPage -- what page am I on? "showMessage"? "addReply"?
ezQuery -- what variables were passed to this page? "topicID=XX.topic"?

Thus, code such as this:

if ( document.location.href.indexOf("http://pub11.ezboard.com/fcooltipsntricksfrm4") != -1 ) {
...
}


can be replaced with:


if ( ezForum == "frm4" ) {
...
}

For this page, http://beta.ezboard.com/fcooltipsntricksfrm4.showMessage?topicID=973.topic, it would do this:

ezPub would be "beta"
ezIsBoard would be false
ezBoardID would be "cooltipsntricks"
ezForum would be "frm4"
ezPage would be "showMessage"
ezQuery would be "topicID=973.topic"

HEAD (box #1):
  <script type="text/javascript">
/* BEGIN EZURL */
ezURL = document.location.href.match("http:\/\/((?:pub|b|p)([0-9]+)|beta|vanchau|inbox)\.ezboard\.com\/(?:.*?\/)?(b|f)([a-zA-Z0-9]+(?=frm[0-9]+)|[a-zA-Z0-9]+(?!frm[0-9]+))(frm[0-9]+|)(?:(?:[\.]{1})([a-zA-Z0-9\=\+\&\.]+)|)(?:(?:[\x3F]{1})([a-zA-Z0-9\=\+\&\.]+)|)(?:.*)");
try {
        if (ezURL.length > 0) {
                ezPub = ezURL[2].length > 0 ? ezURL[2] : ezURL[1];
                ezFullPub = ezURL[1];
                ezIsBoard = ezURL[3] == "b" ? true : false;
                ezBoardID = ezURL[4];
                ezForum = ezURL[5];
                ezPage = ezURL[6];
                ezQuery = ezURL[7];
                }
} catch (e) { }
ezURL = null;
/* END EZURL */
</script>
This script is used in many of the other scripts offered here. Only one copy should be installed.

History:
4/28/2004 - updated for new servers (p)
8/21/2003 - regular expression rewritten to be more efficient
7/27/2003 - fixed bug with multi-page forums
4/1/2003 - fixed bugs with .boardStats pages, etc.
3/31/2003 - completely re-written by phalen180.
8/7/2007 - fixed to work with SEO urls

Credits:
phalen180

Note:
This version also should fix the error in which URLs of the format:

pub13.ezboard.com/fmyforumfrm1?page=2
b2.ezboard.com/fmyforumfrm1?page=3

were not properly parsed

Edited by: ezGoalieAunt at: 8/18/07 6:28 pm

  reply to this message

atlass

ezboard Moderator
ezSupporter
Posts: 3581
Posted: 4/26/04 3:57 pm    
Re: Determine the Board's ID, ForumID, etc. With Code
After the move to the new co-location you'll need to change your ezURL script again. You can change it prior to the move to prevent your scripts from failing to work - as long as I've edited this correctly...

Then new ezURL will be

 <script type="text/javascript">
/* BEGIN EZURL */
ezURL = document.location.href.match("http:\/\/((?:pub|b|p)([0-9]+)|beta|vanchau|inbox)\.ezboard\.com\/(b|f)([a-zA-Z0-9]+(?=frm[0-9]+)|[a-zA-Z0-9]+(?!frm[0-9]+))(frm[0-9]+|)(?:(?:[\.]{1})([a-zA-Z0-9\=\+\&\.]+)|)(?:(?:[\x3F]{1})([a-zA-Z0-9\=\+\&\.]+)|)(?:.*)");
try {
        if (ezURL.length > 0) {
                ezPub = ezURL[2].length > 0 ? ezURL[2] : ezURL[1];
                ezFullPub = ezURL[1];
                ezIsBoard = ezURL[3] == "b" ? true : false;
                ezBoardID = ezURL[4];
                ezForum = ezURL[5];
                ezPage = ezURL[6];
                ezQuery = ezURL[7];
                }
} catch (e) { }
ezURL = null;
/* END EZURL */
</script>


  reply to this message

ezGoalieAunt

ezboard moderator
aka LvsRattlrs

ezSupporter
Posts: 34
Posted: 8/7/07 4:29 pm    
Re: Determine the Board's ID, ForumID, etc. With Code
http://p103.ezboard.com/fezscriptsfrm4.showMessage?topicID=106.topic

For better search engine optimization, ezboard has changed some of the urls on your boards to include thread or forum titles. While this will help get your boards noticed by search engines, it has broken the ezURL script which many scripts rely on to work properly. The script below is a fixed version which will work with your new urls. Simply replace the version on your board with the one in this post.

 <script type="text/javascript">
/* BEGIN EZURL */
ezURL = document.location.href.match("http:\/\/((?:pub|b|p)([0-9]+)|beta|vanchau|inbox)\.ezboard\.com\/(?:.*?\/)?(b|f)([a-zA-Z0-9]+(?=frm[0-9]+)|[a-zA-Z0-9]+(?!frm[0-9]+))(frm[0-9]+|)(?:(?:[\.]{1})([a-zA-Z0-9\=\+\&\.]+)|)(?:(?:[\x3F]{1})([a-zA-Z0-9\=\+\&\.]+)|)(?:.*)");
try {
        if (ezURL.length > 0) {
                ezPub = ezURL[2].length > 0 ? ezURL[2] : ezURL[1];
                ezFullPub = ezURL[1];
                ezIsBoard = ezURL[3] == "b" ? true : false;
                ezBoardID = ezURL[4];
                ezForum = ezURL[5];
                ezPage = ezURL[6];
                ezQuery = ezURL[7];
                }
} catch (e) { }
ezURL = null;
/* END EZURL */
</script>


  reply to this message

Click to receive email notification of replies Click to stop receiving email notification of replies email this topic to a friend

New Topic    Add Reply

jump to:
Topic Control Image::: Topic Commands
Next Topic >>

Icon Legend

reply button:::Reply to Post Button   edit button:::Edit Post Button  delete button:::Delete Post Button (Moderator Only)

subscribe/unsubscribe to thread button:::Subscribe to Thread Button   email to friend button:::Email to Friend Button  



- Cool Tips & Tricks - Javascript FAQ -

Communitiesezboard Help Communities:

Help Forums Help Forums Bug Base Bug Base





Powered By ezboard® Ver. 7.32
Copyright ©1999-2007 ezboard, Inc.