Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#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
Re: I want to use ClickOn with textpattern
It’d really help if you would post your code completely (HTML and TXP). Try this:
- 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). - 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>
<tr onclick=“window.location(‘<txp:permlink />’);”>
<td>
<txp:title />
</td>
<td>
<txp:posted />
</td>
</tr>
</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
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>
<table>
<!— you want to put your opening table tags around the txp:article tag—>
<txp:article form=“Resumen” limit=“4” status=“hidden” />
</table>
</code>
</pre>
form: Resumen Type: Article
<pre>
<pre>
<tr onclick=“location.href = ‘<txp:permlink />’;”>
<td>
<txp:permlink><txp:title /></txp:permlink><!—for non-js/direct link—>
</td>
<td>
<txp:posted />
</td>
</tr>
</pre>
Also, you can simplify your HTML by using CSS instead (removing it from your javascript). (:hover = onmouseover. IE<7 doesn’t support :hover, but every other good browser (Opera, Firefox, Safari) support it. Use this:
<pre>
<style type=“text/css”>
tr {
background: #ccc;
}
tr:hover {
background: #ddd;
cursor: pointer;
}
</style></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
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
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
Pages: 1