Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-08-16 15:26:48

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

[solved] Making a link for an article on the same page

I’m totally new to TXP, so seeing what is possible with TXP and asking this question seems a bit ridiculous to me. But though I’ve searched the forum and several other sources I have’nt found a solution for such a simple thing.

I want to design a single page site (no sections, no sub-pages, nothing) with a linklist at the top of the page that does refer to the articles below. These articles shall not open on a new page if i click one of the links.
I can reach this of course by putting a normal HTML anchor on the first line of the article, but then the article’s title is not visible after clicking the link which is not desirable. And there must be an easier and more foolproof solution. Could anyone help me with this one please? thx

Last edited by uli (2006-08-18 11:13:45)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#2 2006-08-17 00:15:07

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [solved] Making a link for an article on the same page

These articles shall not open on a new page if i click one of the links.

?

Offline

#3 2006-08-17 13:22:25

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: [solved] Making a link for an article on the same page

i don’t want the page to reload or change a section or so when the link gets clicked, i just want the link to take the visitor to another line of the same page, an equivalent to <code><a name“named_anchor”></code> and <code><a href=”#named_anchor”></code>. and that is exactly what reid pointed out here.

Last edited by uli (2006-08-17 13:33:37)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#4 2006-08-18 01:26:18

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [solved] Making a link for an article on the same page

First, go to your article form (most likely “default”), and add an id to each article:

<h3 id="article-<txp:article_id />"><txp:title /> · <txp:posted /> by <txp:author /></h3>

<txp:body />

Next, create a new article form (“list”):

<li><a href="#article-<txp:article_id />"><txp:title /></a></li>

Finally, in your page, call your article list twice:

<ul>
<txp:article form="list" />
</ul>

<txp:article form="default" />

All done. :)

Last edited by Mary (2006-08-18 16:21:00)

Offline

#5 2006-08-18 11:20:19

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: [solved] Making a link for an article on the same page

Mary, thank you so much! This is great! * bouncing around * No getting in contact with any part of the code for my clients. No chance to destroy anything by forgetting a dot, an apostrophe or a blank from textile coded parts. yippeee! :))

<code><for any newbee even newer than me></code>

remove the “w” from the <code><txp:articlew_id /></code>-part appearing twice and it’ll work.

btw, mary made very well-styled code here: <code><a href=”#article-<txp:article_id />”></code>: you can replace the first “article-” with anything you like to appear in the statusbar when the link is being hovered, this “article” has nothing to do with anything txp would need. But take a look at the help text of her plugin upm_image if you’d like to know what well-styled can mean.

<code></for any newbee even newer than me></code>

Last edited by uli (2006-08-18 13:17:37)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#6 2006-08-18 16:22:05

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [solved] Making a link for an article on the same page

…remove the “w”…

Gah, how’d that get in there? sorry ‘bout that. Updated the example.

Last edited by Mary (2006-08-18 16:22:17)

Offline

Board footer

Powered by FluxBB