Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-10-06 01:22:23

neokultur
Member
Registered: 2005-09-23
Posts: 43

I want to use ClickOn with textpattern

I want to use ClickOn in a table in this form:

tr onClick=”location.href=’http://www.mysite.com/’”

Then when the mouse is over the table i can do a click over the table even before to reach the link, and go to mysite.com, all this works fine, only with a link http, but with a txp:permlink doesn’t work

tr onClick=”location.href=’ txp:permlink / ’”

The link is not active in this way, i was thinking the process was similar to del.icio.us:

a href=”http://del.icio.us/post?url=” title=”guardar en del.icio.us”

Any idea? :(

Last edited by neokultur (2006-10-06 01:22:51)

Offline

#2 2006-10-06 01:40:23

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: I want to use ClickOn with textpattern

It’d really help if you would post your code completely (HTML and TXP). Try this:

  1. Admin>Prefs tab, turn comments auto append off. (You’ll need to call the comments form using <txp:output_form form="comments_display" /> in your article form).
  2. In your page template, or wherever you’re generating this table, use <table><txp:article form="tr_list" limit="88" /></table> (or article_custom, if it’s section independent).

form: tr_list

<pre> &lt;tr onclick=“window.location(‘&lt;txp:permlink /&gt;’);”&gt; &lt;td&gt; &lt;txp:title /&gt; &lt;/td&gt; &lt;td&gt; &lt;txp:posted /&gt; &lt;/td&gt; &lt;/tr&gt;
</pre>

Last edited by jm (2006-10-06 01:40:58)

Offline

#3 2006-10-06 05:58:37

neokultur
Member
Registered: 2005-09-23
Posts: 43

Re: I want to use ClickOn with textpattern

Thanks for your lines jm, but a i have the same problem :(

1. In Admi > Preferences > Site Preferences now i have:
Accept comments: No

2. I created a form, but first in my template:
<code><txp:article listform=“Resumen” limit=“4” /></code> <br>

3. In my form called “Resumen”:
<code><table width=“100%” border=“0” cellpadding=“0” cellspacing=“0”> <tr onclick=“window.location(‘<txp:permlink />’)” ; > <td width=“243” height=“45” valign=“top“bgcolor=”#C4C4C4” onMouseover=“this.bgColor=‘lightgrey’; this.style.cursor=‘pointer’;this.style.textDecoration=‘underline’” onMouseout=“this.bgColor=’#C4C4C4’; this.style.textDecoration=‘none’”>
<txp:title /></td></tr></table></code><br>

This generate a link, but only to mysite.com :(

Last edited by neokultur (2006-10-06 06:23:17)

Offline

#4 2006-10-06 06:40:11

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: I want to use ClickOn with textpattern

Oh duh! I forgot it’s supposed to be location.href. I just tested the following, and it works. You should use form instead of listform, since listform is deprecated.

Page Template

<pre>
&lt;table&gt;
&lt;!— you want to put your opening table tags around the txp:article tag—&gt; &lt;txp:article form=“Resumen” limit=“4” status=“hidden” /&gt;
&lt;/table&gt;
&lt;/code&gt;
</pre>

form: Resumen Type: Article

<pre>
&lt;pre&gt; &lt;tr onclick=“location.href = ‘&lt;txp:permlink /&gt;’;”&gt; &lt;td&gt; &lt;txp:permlink&gt;&lt;txp:title /&gt;&lt;/txp:permlink&gt;&lt;!—for non-js/direct link—&gt; &lt;/td&gt; &lt;td&gt; &lt;txp:posted /&gt; &lt;/td&gt; &lt;/tr&gt;
</pre>

Also, you can simplify your HTML by using CSS instead (removing it from your javascript). (:hover = onmouseover. IE&lt;7 doesn’t support :hover, but every other good browser (Opera, Firefox, Safari) support it. Use this:

<pre>
&lt;style type=“text/css”&gt; tr { background: #ccc; } tr:hover { background: #ddd; cursor: pointer; }
&lt;/style&gt;</pre>

Last edited by jm (2006-10-06 06:49:48)

Offline

#5 2006-10-08 15:58:44

neokultur
Member
Registered: 2005-09-23
Posts: 43

Re: I want to use ClickOn with textpattern

Hey! Thanks a lot! It works great! Thanks for help a neophyte in JavaScript like me :P

Another question, what about to create a link?, i mean, i was trying with the same code to do a link from <code> <txp:excerpt /> </code> in this way:

First a fill the EXCERPT section with:

http://www.google.com/

Next i write this code in the OnClick line:

<code><tr bgcolor=”#EEEBE5” onClick=“location.href=’<txp:excerpt /> ‘” ; ></code>

But doesn’t work and the link go to mysite.com and ignore the google address

Last edited by neokultur (2006-10-08 16:00:32)

Offline

#6 2006-10-08 16:25:29

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: I want to use ClickOn with textpattern

For the next problem, what is the returned HTML (view>Source)? I think Textile wraps a <p> tag around the excerpt, so you’ll want to use etz_striptags (similar question).

Offline

#7 2006-10-09 04:05:59

neokultur
Member
Registered: 2005-09-23
Posts: 43

Re: I want to use ClickOn with textpattern

I did install the etz_striptags plugin, looks like a great plugin… But am not sure how to use it or use it for my propose.

First in <b> Content > Write</b> i have:

Title:
Google Link
Body:
http://www.google.com/

And next, in my form called “Resumen”, in the line related to the onclick action:
<b> Presentation > Forms > Resumen</b>

<code><tr bgcolor=”#EEEBE5” onclick=“location.href = ‘<txp:etz_striptags><txp:body /></txp:etz_striptags>’;” ></code><br>
And the post should looks like this:
<b>
Google Link
http://www.google.com/ </b><br>
But i cant get it :(

Last edited by neokultur (2006-10-09 04:07:24)

Offline

#8 2006-10-09 04:15:06

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: I want to use ClickOn with textpattern

What is the returned HTML (not desired) of the actual page?

If you’re just posting a link, using a custom field would be much more appropriate and flexible than the using either the body or excerpt. Create a new custom field (Admin>Advanced), then when posting, click “advanced options” and enter the URL in the field you created.

<code> <tr onclick=“location.href = ‘<txp:custom_field name=“mycustomfieldname” />’;”> <td> <txp:permlink><txp:title /></txp:permlink><!—for non-js/direct link—> </td> <td> <txp:posted /> </td> </tr></code>

Offline

Board footer

Powered by FluxBB