Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-03-12 20:49:27

nejra
Member
From: Groningen
Registered: 2006-07-06
Posts: 38
Website

Redirect from section to article

Hi,

I got a question. Let’s say my txp static site is build like: /section/article. What I want to achieve is if someone goes to www.mysite.com/section1/ he automaticly is redirected to a certain article in that section. For instance I go to www.mysite.com/section2/ that he is being redirected to www.mysite.com/section2/article2/. EDIT

Example code:
<txp:if_section name=“section1”>
<txp:go_to article name=“article2”>
</txp:if_section>

Now I know the tag <txp:go_to> doesn’t exist, but there must be someway to achieve this. Thanks on your thoughts!

Last edited by nejra (2007-03-12 22:44:38)

Offline

#2 2007-03-12 21:45:14

Bastian
Plugin Author
From: Wuppertal, Germany
Registered: 2005-02-02
Posts: 376
Website

Re: Redirect from section to article

I use something like you want my about section:

Use Uses permanent link mode: section/title

Creating a page about and a section about. Make sure that section about uses page about.

Create an article imprint within section about. For example this article has ID = 52.
If you uses this construct:

<txp:if_article_list>
<txp:article id='52'/>
<txp:else/>
<txp:article limit='1'/>
</txp:if_article_list>

instead of <txp:article/>, you will get

http://your-site.tld/about -> Showing up article ID 52
http://your.site.tld/about/my-plugins Showing up article with url-title my-plugins

Offline

#3 2007-03-12 22:14:11

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: Redirect from section to article

You could do that by hand using Apache rewrite rule, or using the Redirect Pro plugin. The plugin way is safer and simpler.

Offline

#4 2007-03-12 22:47:41

nejra
Member
From: Groningen
Registered: 2006-07-06
Posts: 38
Website

Re: Redirect from section to article

Redirect Pro seems the nicest way, but since I don’t have a paypal account (no cc here) it is useless to me. I do have iDeal (another online pay solution). That’s a shame…

I’ll try out Bastians code!

Thanks…

Offline

#5 2007-03-12 23:12:29

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: Redirect from section to article

You could always send a bottle of Bourgogne 1995 to Alex. That might work :-)

Last edited by Jeremie (2007-03-12 23:12:42)

Offline

#6 2007-03-12 23:18:04

nejra
Member
From: Groningen
Registered: 2006-07-06
Posts: 38
Website

Re: Redirect from section to article

It probably would. But that sounds a lot more expensive than $15 (€11) ;). I’m gonna ask my mate to transfer the money I think. It seems a very powerful plugin…

Offline

#7 2007-03-13 08:35:55

FireFusion
Member
Registered: 2005-05-10
Posts: 698

Re: Redirect from section to article

Here is what I do. Any article you want to be the main one for a section just set it to sticky…

<txp:if_article_list>
<txp:article limit="1" status="5" />
<txp:else/>
<txp:article />
</txp:if_article_list>

Offline

#8 2007-03-13 11:57:22

nejra
Member
From: Groningen
Registered: 2006-07-06
Posts: 38
Website

Re: Redirect from section to article

Thanks, but i dont need to display the article. I need to redirect to the article so the url is correctly viewed in the browser.
I have a couple of sections filled with articles and is no need to show the sections just the articles.

Offline

#9 2007-03-13 12:14:13

sthmtc
Member
From: CGN, GER
Registered: 2005-01-17
Posts: 586
Website

Re: Redirect from section to article

maybe this can be realized in a more elegant way but this does the trick for me:

<txp:glx_if_section_frontpage>
<txp:asy_wondertag><txp:zem_redirect to="<txp:article form="url" limit="1" />" /></txp:asy_wondertag>
<txp:else />
<txp:article limit="10" />
</txp:glx_if_section_frontpage>

and the form url contains

<txp:permlink />

Offline

#10 2007-03-14 01:04:46

nejra
Member
From: Groningen
Registered: 2006-07-06
Posts: 38
Website

Re: Redirect from section to article

Jeremie

I’ve bought the plugin. Now i have a problem. When I go to the section i transfer to the article, but when viewing the article it still tries to go to the url ive given! Anyway to solve this?

Offline

#11 2007-03-14 02:10:59

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: Redirect from section to article

I don’t understand.

You want www.mysite.com/section2/ to redirect to www.mysite.com/section2/article2

In section2’s page (template), just add this tag:

<txp:zem_redirect to="/section2/article2" />

If you don’t have a specific page for section2 but a global one, you might want to try this:

<txp:zem_redirect from="/section2/" to="/section2/article2" />

Offline

#12 2007-03-14 12:45:09

nejra
Member
From: Groningen
Registered: 2006-07-06
Posts: 38
Website

Re: Redirect from section to article

Yeah, I have a global one. I have a new problem. View this site. When you hit “systeemplafonds” (a a section you are being redirected to http://klanten.urlremoved.nl/bosma2/systeemplafonds/ARMSTRONGARMSTRONG instead of http://klanten.urlremoved.nl/bosma2/systeemplafonds/ARMSTRONG.

I use this code:

<txp:if_section name="plafonds">
<txp:zem_redirect from="/plafonds/" to="/plafonds/test123" />
</txp:if_section>

When i use a absolute path (with the http://blabla) firefox tells me there is an infinite loop.

Any thoughts? Cheers!

Edit: url removed

Last edited by nejra (2009-09-29 14:41:06)

Offline

Board footer

Powered by FluxBB