Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-03-14 23:42:15

Gena Wenli
Member
From: Ohio, USA
Registered: 2006-01-26
Posts: 34

Getting TXP Post Tile into PHP Script

EDIT: See post #4

Is there a way to wrap certain words in my post subject with <span>?
I’m assuming I could use str_replace, but I need some help. Thanks!

G

Last edited by Gena Wenli (2006-03-15 15:54:20)

Offline

#2 2006-03-15 01:43:15

Elenita
Member
From: Falls Church, VA
Registered: 2004-05-16
Posts: 407
Website

Re: Getting TXP Post Tile into PHP Script

To clarify: certain words, but not the whole thing?

No HTML tags, Textile, etc. entered into the title field will be parsed. But if you want to wrap the whole article title with a <code><span></code> tag, you can definitely do that in your article forms, like so:

<code><span class=“article-title”><txp:title /></span></code>

Otherwise, your best bet would probably be use <a href=“http://textpattern.net/wiki/index.php?title=Txp:php”>txp:php</a> to use php to do what you want.

Last edited by Elenita (2006-03-15 01:44:27)

Offline

#3 2006-03-15 01:51:46

Gena Wenli
Member
From: Ohio, USA
Registered: 2006-01-26
Posts: 34

Re: Getting TXP Post Tile into PHP Script

Yeah, I want to just find specific words in the title field, and then wrap those. I realize that’ll be considerably harder to do. This thread explains better what I want. I’m just not sure how to do that with TXP.

G

Last edited by Gena Wenli (2006-03-15 01:59:18)

Offline

#4 2006-03-15 15:34:05

Gena Wenli
Member
From: Ohio, USA
Registered: 2006-01-26
Posts: 34

Re: Getting TXP Post Tile into PHP Script

Okay, I’ve figured out all the PHP I need to do this, I just need to know how to get the TXP article title into my PHP script.
So right now, in place of my <txp:title />, I have this PHP code:
<code>
<txp:php>
$newstring = NEED TXP TITLE HERE!;
echo str_replace(“oldword”, “newword”, $newstring);
</txp:php>
</code>

The script is pretty self-explanitory. I just need to get the Textpattern post title into the PHP script, then I’m good to go. Anybody know how to do this? Thanks!

G

Offline

#5 2006-03-15 16:01:39

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: Getting TXP Post Tile into PHP Script

You might try <code>parse(‘<txp:title />’); </code> in place of NEED TXP TITLE HERE!;

Offline

#6 2006-03-15 16:03:04

Gena Wenli
Member
From: Ohio, USA
Registered: 2006-01-26
Posts: 34

Re: Getting TXP Post Tile into PHP Script

Thanks, that’s what I wanted. I’m still relatively new to PHP, so thanks for helping, the two of you. :-P

G

Offline

Board footer

Powered by FluxBB