Previous Thread
Next Thread
Print Thread
Hop To
Joined: Jan 2004
Posts: 193
S
sb
Offline
member
member
S Offline
Joined: Jan 2004
Posts: 193
Greetings-

The UBB calendar seems to work well exposed into a Drupal block... (Link to thread) with Firefox. IE8 is giving an error message. I found out how to enable IE script debugging, and it complains about this line of code which is generated by UBB.

day = get_object("day" + today);

It says that variable today is not defined, which indeed at first glance does not seem to me to be defined. Suggestions?

Last edited by sb; 10/16/2010 3:22 PM.
Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
yep, that is a bug

you could (temporarily just remove that javascript section.

it's trying (and failing) to decide which day is today and then css it accordingly to make it stand out on the calendar..

i don't have time to look deeper, but the fix is perty simple too, if you know some javascript smile

header.tpl loads up the value of the today variable as it stands in ubbthread "var today='17';" for example if you view this page's source.

so the solution would be (since you aren't getting that passed into the drupal) to populate today with the value of todays day in month. i can't remember off hand what it is in javascript, but it's googlable if you can't wait til i get back to it wink

edit: never mind.. add these two lines before that line of code

Code
var ubbcal=new Date();
var today=ubbcal.getDay();

should do it smile

Joined: Jan 2004
Posts: 193
S
sb
Offline
member
member
S Offline
Joined: Jan 2004
Posts: 193
Shall I post that into the PHP code snippet that produces the HTML for the calendar block... or do I need to add those lines of code to one of the UBB .php files? A bit of context would be quite helpful. Thanks!

Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
right before the echo <table>

add

Code
echo <<<GET_TODAY
<script>
var ubbcal=new Date();
var today=ubbcal.getDay();
</script>
GET_TODAY;


Joined: Jan 2004
Posts: 193
S
sb
Offline
member
member
S Offline
Joined: Jan 2004
Posts: 193
That code is in UBB file templates/default/island_public_calendar.tpl

So I modified the version on the server as follows:
Code
<script language="javascript" type="text/javascript">
// <![CDATA[
var ubbcal = new Date();
var today = ubbcal.getDay();
day = get_object("day" + today);
currenttitle = day.title;
day.title = "<?php echo $ubbt_lang['TODAY'] ?>\n" + currenttitle;
day.className = "standouttext";
// ]]>
</script>

I then rebuilt the cache so the update would take affect, checked in with Firefox and saw the added two lines.

Now IE8 throws an "Object expected" error on the "day = get_object("day" + today);" line of code.

Further suggestions, please.

Joined: Jan 2004
Posts: 193
S
sb
Offline
member
member
S Offline
Joined: Jan 2004
Posts: 193
aaaahhhh... FF's error console to the rescue now. It says that "get_object" is not defined. That was in the code already... rrr???

Joined: Jan 2004
Posts: 193
S
sb
Offline
member
member
S Offline
Joined: Jan 2004
Posts: 193
This appears to be defined in this file, though inclusion of this file is not within island_public_calendar.tpl

ubb_js/ubb_jslib.js:function get_object(obj)

That just might be a problem...

Joined: Jan 2004
Posts: 193
S
sb
Offline
member
member
S Offline
Joined: Jan 2004
Posts: 193
Bump... may we have some help with this issue please?

Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
Code
day = document.getElementById('day' + today);

Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
You should be able to change this line:

Code

day = get_object("day" + today);


to this:

Code

day = document.getElementById("day" + today);


Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
SD is too fast for me.

Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1


[Linked Image from sirdude.com]



Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Member Permissions Help
by domspeak - 02/27/2024 5:31 PM
Forum Privacy Policy
by ECNet - 02/26/2024 10:58 AM
search error on this site.
by Ruben - 02/24/2024 12:52 PM
UBB 20 Years button
by Morgan - 02/20/2024 4:21 PM
Attachment/Cloudflar
e issue

by Morgan - 02/15/2024 5:47 AM
Who's Online Now
1 members (Geoff), 322 guests, and 399 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)