Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-03-09 20:46:45

baby
Plugin Author
From: Buenos Aires, Argentina
Registered: 2005-10-16
Posts: 95
Website

(perma)link to anchor (or id) inside an article...

Hi,

I want to create a (perma)link to a specific point within an article (and not the top of the article)… I’m using a < div id=“xx”> to identify the spot, but could use < a name=“xx”> all the same…

The question is, how do I create this link?… permalinks don’t seem to allow a “#I_WANNA_GET_HERE” modifier…

Concrete example:

I’m creating a list of entries (within a page template) that selects articles in a specific section like this:

<pre>
#################################
< txp:article_custom form=“article_x_list” limit=“10” section=“my_sect” sortby=“Posted” sortdir=“asc” listform=“article_x_list” />
< txp:if_individual_article> < txp:article limit=“1” form=“article_x” />
< /txp:if_individual_article>
#################################
</pre>

The form “article_list_x” has only the following (and here is where I want to point to the specific anchor):
<pre>
#################################
< txp:permlink>< txp:title />< /txp:permlink>< br />
#################################
</pre>

And the form “article_x” has something along the lines of the following:
<pre>
#################################
< h3>< txp:permlink>< txp:title />< /txp:permlink>< /h3>

SOME DATA < div id=“I_WANNA_GET_HERE”> THE IMPORTANT DATA < /div> ################################# </pre>

TIA


Mariano AbsatzEl Baby

I don’t suffer from insanity. I enjoy every minute of it.

Offline

#2 2006-03-09 22:04:08

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: (perma)link to anchor (or id) inside an article...

I am not sure exactly what are you trying to do, but this is something I whipped up a few months ago. It might give you some ideas.

Offline

#3 2006-03-10 15:39:27

baby
Plugin Author
From: Buenos Aires, Argentina
Registered: 2005-10-16
Posts: 95
Website

Re: (perma)link to anchor (or id) inside an article...

Well… yes… that was what I wanted… <strong>NOW</strong> that I read <em>CLOSELY</em> <a href=“http://textpattern.net/wiki/index.php?title=Txp:permlink”>the entry in the TextBook</a> I see the reference to the <a href=“http://textpattern.net/wiki/index.php?title=Glossary#Single_Tag”>Single_Tag</a> mode of the permlink, which is what I needed.

Thanx a lot for pointing me…

FWIW, I changed the form “article_list_x” from:
<pre>
#################################
< txp:permlink>< txp:title />< /txp:permlink>< br />
#################################
</pre>

to the following: <pre> ################################# < a href=”< txp:permlink />#I_WANNA_GET_HERE” title=”< txp:title />” >< txp:title />< /a>< br /> ################################# </pre>

and I got what I wanted.

Thanx again.


Mariano AbsatzEl Baby

I don’t suffer from insanity. I enjoy every minute of it.

Offline

#4 2006-03-10 16:18:17

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: (perma)link to anchor (or id) inside an article...

Being able to use the permalink tag in single mode was a late but welcome addition to the code base.

Offline

Board footer

Powered by FluxBB