Board index PBase HTML and Style Sheets Page views, gallery, image count for morphed profile page

HTML and Style Sheets

Page views, gallery, image count for morphed profile page

Customize your galleries.
srijith
Moderator
 
Posts: 2321
Location: Amsterdam

Page views, gallery, image count for morphed profile page

Post Sat Jun 02, 2007 6:17 pm


Do not use this 'hack' unless stated otherwise at a later stage more details...


For people who have morphed their profile page (eg: mine), a problem used to be the inability to present the current image views, gallery count and image counts due to its dynamic nature.

Fret not :) Using the following Javascript code will get the work done. Note that this works with non-IE browsers only. See below how to handle IE.

Code: Select all
function getElementsByAttribute(attr,val,container)
{
        container = container||document
        var all = document.getElementsByTagName('*')
        var arr = []
        for(var k=0;k<all.length;k++)
        if(all[k].getAttribute(attr) == val)
        arr[arr.length] = all[k]
        return arr
}

function showTotal() {

        if (getElementsByAttribute("class","wb","document")[6].childNodes[5].firstChild.nodeValue) {
                views=getElementsByAttribute("class","wb","document")[6].childNodes[5].firstChild.nodeValue;
                temp=getElementsByAttribute("class","wb","document")[6].childNodes[2].nodeValue;
                galleriesImages = temp.split(' ');
                galleries=galleriesImages[6];
                images=galleriesImages[9];
                document.getElementById('totalview').firstChild.nodeValue=views;
                document.getElementById('totalgalleries').firstChild.nodeValue=galleries;
                document.getElementById('totalimages').firstChild.nodeValue=images;
        }
        else alert('Your browser doesn\'t support the Level 1 DOM');

}



Use it as follows in HTML of profile:

Code: Select all
<!--[if !IE]>--><script type="text/javascript" src="http://host.com/location/profile.js" /><!--<![endif]-->
Over <b id="totalview">rough_no_for_IE</b> views
Galleries:<b id="totalgalleries">rough_no_for_IE</b>
Images:<b id="totalimages">rough_no_for_IE</b>
<!--[if !IE]>--><body onload="showTotal()"><!--<![endif]-->


rought_no_for_IE has to be substituted for a rough number that will be shown to IE users. Firefox and Opera users will see the correct dynamic numbers.

Of course you need to save the Javascript as profile.js and change the location of host.com in the html above. Note that the details you get when you logged in as yourself may looked messed up, but for anyone else (other pbase users and non-logged in visitors) it will display correctly.

Code released under GPL 2.0
Last edited by srijith on Fri Nov 23, 2007 10:14 am, edited 2 times in total.

arjunrc
 
Posts: 1003


Post Sun Jun 03, 2007 1:38 am


Good stuff srijith. this certainly helps with the dynamic information part.
You may want to check it in IE7 - the current script locks in "calculating" phase on your profile and only half the profile page shows up as a result.
--
I don't check forums very often these days, so if you need to get a response from me, please send me an email (see my profile) and NOT a PM.

srijith
Moderator
 
Posts: 2321
Location: Amsterdam


Post Sun Jun 03, 2007 6:25 am


arjunrc wrote:Good stuff srijith. this certainly helps with the dynamic information part.
You may want to check it in IE7 - the current script locks in "calculating" phase on your profile and only half the profile page shows up as a result.

Thanks for catching that Arjun. I hardly use IE these days and hence forgot that it exists :)

Well, due to the trick I use (to do you know what), looks like IE will not work well. So instead, let us put a rough enough number for IE instead of 'calculating' and warp the 'offending' part in 'IF'. Have updated the original entry to reflect the changes needed.

srijith
Moderator
 
Posts: 2321
Location: Amsterdam


Post Sun Jun 03, 2007 6:51 am


If you want it working correctly for yourself also, play with if else statement using value in galleriesImages[5] and change numbers in
Code: Select all

galleries=galleriesImages[6];
images=galleriesImages[9];

gaild
 
Posts: 79

How?

Post Sun Oct 14, 2007 5:55 pm


Is it easy to design a profile page like yours... or only for the experts (which I am not!)?

Thanks
Gail

lumbardh
 
Posts: 7


Post Wed Oct 17, 2007 5:48 pm


Yeah, how did you do that? I like the look!

srijith
Moderator
 
Posts: 2321
Location: Amsterdam


Post Mon Oct 22, 2007 3:31 pm


Sorry for the late reply. The trick to morph the profile page is easy. I could share it with you if you send me a private forum PM.

However, you still need to design your own HTML to make it look the way you want it. After applying the trick you will be left with an empty page which you can edit like any other normal HTML page.

srijith
Moderator
 
Posts: 2321
Location: Amsterdam


Post Fri Nov 23, 2007 10:12 am


Upcoming Firefox 3 is more strict regarding javascript tag syntax and that combined with PBase policy of stripping all Javascripts will leave this script useless and will mess up the profile page.

Please discontinue its use until stated otherwise at a later stage.


Board index PBase HTML and Style Sheets Page views, gallery, image count for morphed profile page

Who is online

Users browsing this forum: ClaudeBot and 0 guests