Re: [SMARTY] Table of Contents
| From: | CPT John W. Holmes | Date: | Thu, 18 Sep 2003 20:19:52 +0000 |
| Subject: | Re: [SMARTY] Table of Contents | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10238@lists.php.net to get a copy of this message | ||
From: "Markus Weber" <preml@gmx.net>
> can I use Smarty to create a "Table of Contents"? The Table of Contents
> should contain links to all headlines on a page.
>
> Example:
> <H1>Introduction</H1>
> <H1>How to build a station</H1>
> <H2>Step1</H2>
> <H2>Step1</H2>
>
> For the above example an table of contents like the following should be
> generated:
>
> | Table of Contents:
> | - Introduction
> | - How to build a station
> | - Step 1
> | - Step 2
Seems like it'd be smarter to use CSS for this and define certain
indentations for each <Hx> tag...
I guess you could do something like
$H1 = "| - ";
$H2 = "| - ";
and use
{$H1}Introduction
{$H1}How to...
{$H2}Step 1
I'm sure there are other methods, too.
---John Holmes...