Fossil Forum

hruodr 1 month, 2 weeks ago

Post: Values of $current_page in th1 for standard pages

I want to put Javascript in the footer of some pages: home page, wiki pages, forum posts, in pages for previewing entered text, but not everywhere.

I have something like:

set cp3 [string range $current_page 0 2] if {$cp3 eq "hom" || $cp3 eq "for" || $cp3 eq "wik" || $cp3 eq "tkt" || $cp3 eq "tec" } { html {...}

But I want exact names, not with the first 3 letters. How do I get the names?

"home" for the home pages, "wiki" for wiki seems not to work.

Thanks Rod.

andybradford 1 month, 2 weeks ago

But I want exact names, not with the first 3 letters. How do I get the names?

I don't use TH1, but could you just experiment a bit and output the value of $current_page somewhere in the HTML so that you can discover their names?

hruodr 1 month, 2 weeks ago

Thanks!

That is what a real programmer does and is called, I think, debugging.

In the footer "This page was generated in about ..." I inserted $current_page immediately after page.

And got big surprise, not the names as I expected.

Now I must think how I proceed.

Perhaps th1 could be usable for generating dynamic pages, but as far as I know, it is not interpreted in the body.

stephan 1 month, 2 weeks ago

Perhaps th1 could be usable for generating dynamic pages,

This has been explored before it doesn't end well. The most significant problem, IMO, is that debugging broken th1 in any non-trivial script is about impossible because of a lack of line information (the internals of th1 doesn't support carrying that info around).

Even so, see and search for "th1", noting that none of the active developers, AFAIK, are known to use that feature, making it largely unsupported.

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button