rejetto forum
May 24, 2012, 02:17:17 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: This forum is free, you do NOT need to register to post. But you may.
PROBLEMS? QUESTIONS? CLICK HERE!
Fill the survey!
 
   Home   Help Search Login Register  
Pages: 1 2 [All]
  Print  
Author Topic: Browsable Folder Tree  (Read 6219 times)
0 Members and 2 Guests are viewing this topic.
Giant Eagle
Moderator
Insane poster
*****
Offline Offline

Netherlands Netherlands

Posts: 533


>=3 RAWR!

no.body056@gmail.com
View Profile WWW
« on: February 04, 2007, 06:03:33 AM »

That_Stevens_Guy, Flynsarmy and I have been working on a new feature called the Browsable Folder Tree..

This project was based on a request made by Fabnos in the "Converted Template" topic. It was my idea, TSG made some suggestions and Flynsarmy improved the code Smiley

here goes:

If you, for example, browse a folder called /folder1/example foldername 2/example 3/ then its now possible to click on Folder 1 to go there, instead of pressing "Up, one folder" multiple times.

This code is written in JavaScript, but even if the user disabled JS, they wont notice a thing. It replaces the current %folder% with the Folder Links.

The code:
Code:
function dirLinks() {

var path="%folder%".split("/");;
var pathTree="";
var pathTreeResult="";

for(pta=1;pta<path.length;pta++) {
          pathTree=pathTree+"/"+path[pta];
          pathTreeResult=pathTreeResult +'/<a href="'+pathTree+'" class=\"swapDir\">'+path[pta]+'</a>';
      }
    document.getElementById('swapDir').innerHTML = pathTreeResult;
}


Then, where %folder% is located in your template, replace it with this, this code also allows /Home browsing when js is turned off:
Code:
Current Directory: /<a href="/" class=swapDir>Home</a><span id=swapDir>%folder%</span>
<script type="text/javascript" language="javascript">dirLinks()</script>
This code is based on the ToG Template

Some CSS which can be easily modified, it will allow the links to act as you want them.
Code:
a.swapDir:link, a.swapDir:active, a.swapDir:visited {
        color:#fff;font-weight:normal;
}

a.swapDir:hover {
        color:#CAD9EA;
}
This code is also based on the ToG Template

Of course.. This function is also implemented in my template Grin (HFS Terayon v1.2)

To test it on the latest build of the ToG
User: guest Pass: guest

To test it on the latest test build of HFS Terayon - Click here!
« Last Edit: May 13, 2010, 12:55:52 AM by TSG » Logged

Rest in peace 500mhz server, you served me well...
New 1500mhz server DOA'ed on me >_>
New 2400mhz server up and running again Grin

TSG
Moderator
Insane poster
*****
Offline Offline

Australia Australia

Posts: 1919



View Profile WWW
« Reply #1 on: February 05, 2007, 11:58:23 PM »

No comments?... bugs?... things that we need to know about?
Logged

rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11829


View Profile
« Reply #2 on: February 06, 2007, 12:48:48 AM »

yes: it's nice Grin
Logged
traxxus
Guest


Email
« Reply #3 on: February 07, 2007, 04:11:10 PM »


Then, where %folder% is located in your template, replace it with this, this code also allows /Home browsing when js is turned off:
Code:
Current Directory: /<a href="/" class=swapDir>Home</a><span id=swapDir>%folder%</span>
<script type="text/javascript" language="javascript">dirLinks()</script>
This code is based on the ToG Template


I dont understand this part.... every %folder" tag ? dont works. Please explain it exactly what i have to do.
Logged
TSG
Moderator
Insane poster
*****
Offline Offline

Australia Australia

Posts: 1919



View Profile WWW
« Reply #4 on: February 07, 2007, 09:08:36 PM »

It doesn't do every %folder% tag... just the one you want it to do Cheesy

Notice on most templates how there is a %folder% tag after the words Current Directory: "%folder%" usually somewhere in the main section of the template. And when you browse the template you notice it show the current folder in a line of "Current Directory:/Files/Images/Babes/You get my drift/" well currently this is not a usable part of the navigation of the HFS, so what we have done with this code is allow you to turn the folder tree into a key part of the HFS navigation. it's very useful. We have also included a /Home default which is available even when JavaScript is turned off.

All you have to do locate where that folder tree is created in you template, and replace it with the code you quoted and asked help for.

I hope this helps.
Logged

traxxus
Guest


Email
« Reply #5 on: February 09, 2007, 04:48:58 AM »

No, i cant do it... its to hard. I will wait for Terayon 1.2....  Embarrassed
Logged
rejetto forum
« Reply #5 on: February 09, 2007, 04:48:58 AM »

Do you like this software? Consider even $2
 Logged
fabnos
Tireless poster
****
Offline Offline

Italy Italy

Posts: 278



View Profile WWW
« Reply #6 on: February 09, 2007, 05:33:44 AM »

No, i cant do it... its to hard. I will wait for Terayon 1.2....  Embarrassed

Also I, very waiting  Wink
Ciao
f
Logged

E allora Dio creò l'uomo, gli diede un cervello ed un pene ma non sangue sufficiente a farli funzionare  contemporaneamente.
_______
So, God created the man.
It gave him a brain and a penis.
Unfortunately not enough blood to contemporarily bedew them
TSG
Moderator
Insane poster
*****
Offline Offline

Australia Australia

Posts: 1919



View Profile WWW
« Reply #7 on: February 09, 2007, 05:45:52 AM »

Yes Terayon is a little harder to edit lol, i was only talking about it from the ToG point of view, We are one bug away from releasing a clean version of ToG, and as for the Terayon, well thats got a few more bugs left to fix lol. but Giant Eagle is getting there.

I have told GE to post on how to do it for Terayon.
Logged

traxxus
Guest


Email
« Reply #8 on: February 09, 2007, 06:45:34 AM »

Ok, i have successfully integrated into the ToG template  Grin
Logged
Salerno
Guest


Email
« Reply #9 on: May 24, 2007, 03:54:52 PM »

Well I've been trying to get this working on my own website and I just can't. Could you be a bit more specific as to where exactly each piece of this code needs to be placed (especially the javascript code seeing as I don't have any other JS on my page).
Also, when you say "if Javascript is not enabled they won't notice a thing" does that mean that the tree won't function as intended but will still display as normal text. Or do you mean that it will work just as if the user has Javascript enabled. Stupid questions but if you could give me a straight answer I'd really appreciate it.
Logged
TSG
Moderator
Insane poster
*****
Offline Offline

Australia Australia

Posts: 1919



View Profile WWW
« Reply #10 on: May 24, 2007, 05:14:36 PM »

We have it set so that when javascript is turned on, the javascript automatically rewrites the %folder% that is inside a span with the 'browseable %folder% tree'. If javascript is turned off, the span will not be re-written so the default folder tree is visible.

Basically yes, without javascript they see the default text version of %folder%.

Put the javascript in the <head> section of your template between <script type="text/javascript"></script>, and put the css in the [style] section or in <style> or an external .css file. And the html part goes in your <body> where your current %folder% tag lies.

<doctype meh...>

<html>
<head>
<meta etc.>
<title etc.>
<script type="text/javascript">
//javascript
</script>

<body>

<!-- the html part.... somewhere-->

</body>
</html>



I will post up the version of this that can use external javascript files whenever i get time, checkout the latest ToG for that version.
« Last Edit: May 24, 2007, 05:31:35 PM by That_Stevens_Guy » Logged

salerno
Guest


Email
« Reply #11 on: May 24, 2007, 07:50:53 PM »

THANKYOU!
I really appreciate your post (the edited version Grin) because it was exactly what I was looking for!
When I responded I was looking at the original post so once again, thanks.
Logged
TSG
Moderator
Insane poster
*****
Offline Offline

Australia Australia

Posts: 1919



View Profile WWW
« Reply #12 on: July 26, 2007, 09:48:19 AM »

NEW TOG VERSION - even though its about 4 months old now Smiley

In the head of your template you have to do this when using external files:
<script type="text/javascript">var Fldr="%folder%";</script>

If you are using the main code in the head of the template, you must put the following above the function:
var Fldr="%folder%";

This is the main code that does the string splitting and stuff...
//Breadcrumbs
function bCrumbs() {
   x="/";
   y=Fldr.split(x);
   bC="";
   for(z=1;z<y.length;z++){
      x=x+y[z]+"/";
      bC=bC+'/<a href="'+x+'" class=swpFt>'+y[z]+'</a>';
   }
   document.getElementById('swpFt').innerHTML = bC;
}

Ok, now we have the main scripts... next we must set up the html...
<div class=dr>
    Current Directory: <a href="/" class=swpFt>Home</a><span id=swpFt>%folder%</span>
    <script type="text/javascript">bCrumbs()</script>
</div>

Done, you now have a bread crumb trial.

You can work out what to do with the css... I cant be bothered writing out some classes to style it... if you require an example i will post that.

Note: <script type="text/javascript">bCrumbs()</script> MUST be placed just after the element that you are changing.
Note: You will notice my version of the code is smaller than what you find on the terayon, i have compressed it a fair bit.

Good Luck  Wink
« Last Edit: July 26, 2007, 09:53:25 AM by That_Stevens_Guy » Logged

Giant Eagle
Moderator
Insane poster
*****
Offline Offline

Netherlands Netherlands

Posts: 533


>=3 RAWR!

no.body056@gmail.com
View Profile WWW
« Reply #13 on: July 26, 2007, 03:01:36 PM »

This is the main code that does the string splitting and stuff...
//Breadcrumbs
function bCrumbs(Fldr) {
   x="/";
   y=Fldr.split(x);
   bC="";
   for(z=1;z<y.length;z++){
      x=x+y[z]+"/";
      bC=bC+'/<a href="'+x+'" class=swpFt>'+y[z]+'</a>';
   }
   document.getElementById('swpFt').innerHTML = bC;
}

Ok, now we have the main scripts... next we must set up the html...
<div class=dr>
    Current Directory: <a href="/" class=swpFt>Home</a><span id=swpFt>%folder%</span>
    <script type="text/javascript">bCrumbs("%folder%")</script>
</div>
Logged

Rest in peace 500mhz server, you served me well...
New 1500mhz server DOA'ed on me >_>
New 2400mhz server up and running again Grin

TSG
Moderator
Insane poster
*****
Offline Offline

Australia Australia

Posts: 1919



View Profile WWW
« Reply #14 on: July 26, 2007, 07:38:20 PM »

Thanks, thats another way to do it, Tongue i was too lazy to change the code.
Logged

TCube
Insane poster
*****
Offline Offline

France France

Posts: 431



View Profile
« Reply #15 on: November 15, 2007, 01:39:26 PM »

implemented ! Thanks U 2 guys  Wink
Logged

Make it idiot-proof and I will make a better idiot
Pages: 1 2 [All]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!


Google visited last this page May 19, 2012, 10:13:43 AM
anything