SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist ucahg's Avatar
    Join Date
    Apr 2001
    Location
    Sarnia, Ontario, Canada
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Custom Formatting and Nested Lists

    Hello,

    I'm trying to create a content formatting function that will allow for nested lists. Basically where I'm stuck is the nested lists part . For every opening list tag, I want to find the correct closing list tag {to make sure it's there and to replace it with the correct HTML tag (<UL>,<OL>)}. How would I match the nested tags so it doesn't just find the first closing list tag that comes around, but finds the one that corresponds with the original opening tag. I hope I'm being clear enough.

    Thanks for reading this and I hope you can help shed some light to as what I should do.
    Last edited by ucahg; Sep 3, 2001 at 16:35.

  2. #2
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In your while loop (or for loop etc.) that you use to go through the records, create a variable called $tag, in tag store:

    ol>
    ul>

    etc. for the tag you are currently using, then when you print the first item you can do:

    echo '<'.$tag;

    when you print the last item you can do:

    echo '</'.$tag;

    I hope this is something like what you mean.
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting
    Call 0800 542 9764 today and ask how we can help your business grow.

  3. #3
    SitePoint Evangelist ucahg's Avatar
    Join Date
    Apr 2001
    Location
    Sarnia, Ontario, Canada
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    hmmm...

    So far I was using simple eregi_replaces, so I have no loops.

    Could you either help me put it into a while (or for) loop, or tell me where I could find a premade formatting script like this (because I'm sure there must be some).

    Thanks!
    Last edited by ucahg; Sep 5, 2001 at 16:23.

  4. #4
    SitePoint Evangelist ucahg's Avatar
    Join Date
    Apr 2001
    Location
    Sarnia, Ontario, Canada
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    anybody?

    *bump up*

    there must be some premade scripts/functions out there. or could someone please point me in the right direction into how I would make my own. Thanks!


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
  •