Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-05-21 11:16:42

Totobuvika
New Member
From: Remscheid, Germany
Registered: 2010-05-21
Posts: 3
Website

<txp:comment_web_input /> is missing title tag

Hello,

I’m new in Textpattern, I come from WordPress.

For SEO it would be fine if the commentator’s web adress had a title tag. Let me explain: <txp:comment_web_input /> in the comment form does not have an option to type in a title. It would be enough if a title tag gets generated automatically.

But I don’t know how to do it. I think the code for <txp:comment_web_input /> has to be changed, not the comment form, but I have to admit that I haven’t found a way to do that. I don’t even find the file where this code is.

I searched in this forum and also with the help of Google, but … nothing helpful for my case. If someone could help me, that would be great!

Thanks in advance,
Torsten


On Error Goto Bed

Offline

#2 2010-05-21 22:17:06

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: <txp:comment_web_input /> is missing title tag

Instead of using the <txp:comment_web_input /> tag try using an <input /> tag instead and adding the title attribute like so:-

<input type="text" value="" name="web" size="25" class="comment_web_input" id="web" title="" />

Apart from the “title” addition this is exactly what the Txp tag outputs.

Last edited by thebombsite (2010-05-21 22:18:05)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#3 2010-05-21 23:27:22

Totobuvika
New Member
From: Remscheid, Germany
Registered: 2010-05-21
Posts: 3
Website

Re: <txp:comment_web_input /> is missing title tag

Hi Stuart,

thanks for your help, but unfortunately it does not work. The following error message is spit out:

Strict Standards: Non-static method timezone::is_dst() should not be called statically in …/textpattern/lib/txplib_misc.php on line 1265 Strict Standards: Non-static method timezone::is_supported() should not be called statically in …/textpattern/lib/txplib_misc.php on line 2523

And the text from the input field (for the URL) disappers when previewing.

I think some function has to be changed, but I can’t find it. Thank you nonetheless.


On Error Goto Bed

Offline

#4 2010-05-22 00:24:29

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: <txp:comment_web_input /> is missing title tag

Totobuvika wrote:

thanks for your help, but unfortunately it does not work.

The method Stuart proposed indeed works.

The following error message is spit out:

Strict Standards: Non-static method timezone::is_dst() should not be called statically in …/textpattern/lib/txplib_misc.php on line 1265 Strict Standards: Non-static method timezone::is_supported() should not be called statically in …/textpattern/lib/txplib_misc.php on line 2523

Torsten, the error message you are having is unrelated to the change you made. Theres been some talk about the error in the past, and fixes are available (in the topic below and the revision):

Back to the title thing. There is one thing that Stuart’s simple example can’t do; it doesn’t store the value while the comment is previewed as you noticed. There are some methods that can help, for example something like:

<input type="text" value="<txp:php> echo htmlspecialchars(ps('web')); </txp:php>" name="web" size="25" class="comment_web_input" id="web" title="" />

If also the cookie storing functionality is needed, then we could use rah_replace to insert the title attribute. Something like:

<txp:rah_replace from="class=""comment_web_input""" to="class=""comment_web_input"" title=""MyTitleHere""">
	<txp:comment_web_input />
</txp:rah_replace>

I think some function has to be changed, but I can’t find it.

Modifying core without a reason is never a good thing (and in this title case there is no real reason) ;-) There aren’t functions responsible of the comment form tags. They are unlike any other tags and aren’t functions like others are. The comment form tags are simply replaced with strings in /publish/comment.php.

Last edited by Gocom (2010-05-22 00:43:27)

Offline

#5 2010-05-23 12:56:34

Totobuvika
New Member
From: Remscheid, Germany
Registered: 2010-05-21
Posts: 3
Website

Re: <txp:comment_web_input /> is missing title tag

Thanks for your help, Jukka and Stuart, but I think I did not explain correctly what my goal is. English is not my natural language, so please forgive me if my questions were a bit unclear. Besides, I was on the fool’s errand, searching in the wrong files for the relevant source code.

Actually I don’t want to add a title attribute to the input field, but to the commentator’s link to his or her website. Today I’ve fixed the problem. I changed a line (# 1921) in
textpattern/publish/taghandlers.php
(adding title=“Website”):

if ($web) { return '<a href="http://'.htmlspecialchars($web).'" '.$nofollow.' title="Website">'.$name.'</a>'; }

And here you can see a screenshot: http://www.sackmuehle.de/textpattern/uploads/link-with-title.png

Anyway, the help of both of you prepared the ground for finding the solution, so thanks again, guys!
Torsten


On Error Goto Bed

Offline

#6 2010-05-23 16:02:59

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: <txp:comment_web_input /> is missing title tag

Totobuvika wrote:

Today I’ve fixed the problem. I changed a line (# 1921) in
textpattern/publish/taghandlers.php

It’s never adviced to modify core without a good reason. That one doesn’t require any mods:

<a href="<txp:comment_web>" title="Website">
	<txp:comment_name link="0" />
</a>

If conditionals are required:

…and more:

Offline

Board footer

Powered by FluxBB