Results 1 to 9 of 9

Thread: Creating a TOC, how to?

  1. #1
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Creating a TOC, how to?

    Hello everyone,

    I was trying to create a TOC(Table Of Contents) script but I have no clue howto. Can anyone help me or give me a link to a website that teaches how to make one? Any help would be greatly appreciated.

    Thanks.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Ummm.... <a href="link">link</a><br>, repeat?

    PHP could help, but only if your setup allows it to.

    You could do a directory/file listing (there's a script around here that Twey ddi that could help), or you could use the information from a database. There might be other options as well, but those seem the most likley.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Take a look at the following links and see if this is sort of what you are looking for.

    http://www.dhtmlgoodies.com/scripts/...toc-maker.html
    http://www.dhtmlgoodies.com/scripts/...-example2.html

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  4. #4
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    testingsite: It is something like that but, with PHP(I may use that if I change into ajaxifying the whole layout)

    drj33: Can you tell me where that script is Twey made? My server(which is localhost) would allow me to do anything.;p I am not using a database by the way. I think there are TOCs made of PHP which get the content of headings and print them in a managable way(most wikis have them like dokuwiki).

    drj33, thetestingsite: Thanks anyways.

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Hmm.... interesting.

    You could do a directory listing script, then look for the <title> markup in the html. But, that might take a very long time. Not really sure, though.

    here's my thread asking about a related topic... I'm sure some of these ideas could help you--
    http://www.dynamicdrive.com/forums/s...ad.php?t=14078
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks, drj33!! I thought of doing a regexp search through the files(which are remotely included) but then again, I was not really good at regexps.

  7. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    regex is complex, and confuses me, but there's no real reason to ever NEED to use it... it just saves time. Instead of manually using 8 ifs, several while loops and such, you can just use a regex to do it by itself.
    But.... not sure how it would help here.
    If you did want to parse through the html, just split at the position at which <title> occurs, then again at </title>.
    You could use explode too, and just use
    list($null,$varyouwant) = explode('<script>',$html,2);
    list($varyouwant,$null) = explode('</script>',$varyouwant,2);

    where 2 is the limt of parts in case <title> accidentally appears twice, so it's not messy on the php end of things. But that might be a little innefficient... I dunno. I tried something like it recently but it was VERY slow, but it might be faster if you're not using remote files, if you're using local files without using an include statement and output buffer like I was.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  8. #8
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    drj33: Well, let me try that.Thanks again!!

  9. #9
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Hmm... no clue why I put <script> and </script> there.... I meant title.
    Oh well.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •