Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-06-11 17:16:05

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,674
GitHub Twitter

Automaticly redirect to a specific section?

Is it possible to redirect automaticly to a section when I clic on a permlink’s special article?
So, I have many users on my site. All of the user’s name got an individual bio article show when you clic on their name. I want to redirect to my contact section when I clic on a specific user name.
This sample code on an specific article don’t redirect automaticly :
<code><txp:php>
header(“Location: http://domain.com/?s=contact”);
</txp:php></code>
Someone has an idea?
Thanks by advance.


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#2 2006-06-11 18:40:27

Tinshack
Member
From: South Africa
Registered: 2005-12-04
Posts: 18
Website

Re: Automaticly redirect to a specific section?

B’n working on my own redirect plugin thingy, so let me see if I can help.

First question: what and why exactly are you trying to redirect? It may just be a simple case of changing one of your article forms (change <code>&lt;txp:author link=“y” /&gt;</code> to <code>< a href=“http://domain.com/?s=contact”>< txp:author />;< /a></code>). This would partly eliminate the need for a fancy redirect thing. The only reason to keep it after that would be for redirecting old search engine referrals and bookmarks.

There are probably a few reasons why your redirect code isn’t working.

Is txp:PHP enabled? If it’s not then you’ll need to enable it using the advanced site preferences. Be sure that turning it on won’t negatively affect your site’s security (by allowing authors to post malicious code).

Next thing: a simple location header doesn’t always work, depending on your configuration. Place <code>txp_status_header(301)</code> in your php code, just before the location header. That sets the status code for your script. See <a href=“http://www.ietf.org/rfc/rfc2616.txt”>RFC2616</a> for a list of other status codes you could use.

When reading the above keep in mind that: I have read some of the applicable RFCs – especially <a href=“http://www.ietf.org/rfc/rfc2616.txt”>RFC2616</a> which specifies HTTP1/1. That doesn’t mean I know what I’m doing, or that I’m doing things the correct way.

Offline

#3 2006-06-11 19:06:32

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,674
GitHub Twitter

Re: Automaticly redirect to a specific section?

Tinshack, in fact I need a conditional tag to check if my visitors clic on a specific author’s permlink : <em>me</em> ; and redirect to my contact form (in a section named “contact”). In the other cases, the permlink show the bio section where I’ve put personnal infos of the other authors.

Take a look of my structure’s site :

My “<strong>author</strong>” section contains this :

(…)
<code>
<txp:if_individual_article>
<h4>Other articles by this author :</h4>
<txp:chh_related_articles relation=“author” limit=“100” break=“li” wraptag=“ul” section=“blog,news,web-gallerie,photo-gallerie,compositing-gallerie-3D-gallerie” sortby=“Title” />
</txp:if_individual_article>
</code>
(…)

…and in my “<strong>default</strong>” form, I’ve put this :

(…)
<code>
<txp:posted /> by <a href=”<txp:site_url />author/<txp:author />” title=“About <txp:author />” class=“articleAuthor”><txp:author /></a>
</code>
(…)

…and I publish articles with individual name’s author for the article’s title to display the bio informations when visitor’s clic on the corresponding author’s name for the article currently shown.

Now, I would like to point directly in the contact section when visitors clic on my personnal name… and I can’t find the good way to acomplish this…

By advance, thanks for your help Tinshack.
Regards.


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#4 2006-06-11 20:28:25

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

Re: Automaticly redirect to a specific section?

You’ll need to grab a plugin. A built-in tag is available in svn, so you’ll just need it until the next release.

<txp:rss_if_author author="yourusername">

	<p><txp:posted /> by <a href="<txp:site_url />?s=contact" title="Contact <txp:author />"><txp:author /></a></p>

<txp:else />

	<p><txp:posted /> by <a href="<txp:site_url />?author=<txp:author />" title="About <txp:author />"><txp:author /></a></p>

</txp:rss_if_author>

:)

Offline

#5 2006-06-12 06:53:39

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,674
GitHub Twitter

Re: Automaticly redirect to a specific section?

Thank you Mary.
… and could you tell you when the next release will be available : the core developpers work a lot on the trac since the previous months. It seems to be finished very soon?

Last edited by Pat64 (2006-06-12 06:53:53)


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#6 2006-06-12 07:05:54

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

Re: Automaticly redirect to a specific section?

It seems to be finished very soon?

Hopefully. :) There’s no set date, it’s awaiting a couple important fixes.

Offline

#7 2006-06-12 08:03:41

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,674
GitHub Twitter

Re: Automaticly redirect to a specific section?

XML RCP is the (very) new important implementation in TXP. It’s seems a possibility to give data from many different sources. Could we take differents examples and usages in that way?


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#8 2006-06-12 23:15:52

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

Re: Automaticly redirect to a specific section?

Sorry, I don’t understand. What are you asking?

Offline

Board footer

Powered by FluxBB