Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-09-22 17:10:49

morgansutherland
New Member
Registered: 2007-09-22
Posts: 5

<txp:title /> inline with <txp:body />

This is a mock-up HTML page of how I want my site to look: http://morgansutherland.net/beta/index2.html

This is how it looks when textpattern’d: http://morgansutherland.net/

How can I make <txp:title /> display inline with <txp:body />?

The problem lies in the fact that anything that comes out of <txp:body /> is wrapped in “<p>” tags. Is there anyway to specify that <p> tags shouldn’t start a new line? Or is there anyway to mess with the code so that <txp:body /> spits out the body including the title?

Offline

#2 2007-09-22 17:23:46

obeewan
Archived Plugin Author
From: Stockholm, Sweden
Registered: 2004-08-12
Posts: 319
Website

Re: <txp:title /> inline with <txp:body />

The <p></p> doesn’t come from the actual tag itself but from Textile when it goes through the contents of the body.

The solution right of the bat is always to add <txp:title /> first in your body text.

Another solution is to do the following:

<txp:php>
global $thisarticle;
echo parse('<p><span class="theTitle">'.$thisarticle['title']."</span>".substr($thisarticle['body'],4));
</txp:php>

instead of <txp:body />.

Edit:
And don’t ask me why it should be ,4 in the end. I’d say 3 but when tested didn’t work.

Last edited by obeewan (2007-09-22 17:25:25)


Plugins: ob1_advanced_search 1.032b, ob1_search_score 1.0, ob1_pagination 2.5, ob1_title 4.1, ob1_modified 2.1

“Let your plans be dark and as impenetratable as night, and when you move, fall like a thunderbolt.”
— Sun Tzu

Offline

#3 2007-09-22 17:27:27

morgansutherland
New Member
Registered: 2007-09-22
Posts: 5

Re: <txp:title /> inline with <txp:body />

Aha, that’s perfect. I didn’t think of putting the title tag right in the article! However, I’d prefer not to go back and modify all of my previous entries that I imported form WordPress, so I’ll give the other solution a try.

Last edited by morgansutherland (2007-09-22 17:27:51)

Offline

#4 2007-09-22 17:32:42

morgansutherland
New Member
Registered: 2007-09-22
Posts: 5

Re: <txp:title /> inline with <txp:body />

Ok, and I just tried your code and it works perfectly. Thanks a lot!

Offline

#5 2007-09-22 17:53:01

obeewan
Archived Plugin Author
From: Stockholm, Sweden
Registered: 2004-08-12
Posts: 319
Website

Re: <txp:title /> inline with <txp:body />

Do you think you could modify the above code to included the permalink on/in the title?

<txp:php>
global $thisarticle;
echo parse('<p><txp:permlink />'.substr($thisarticle['body'],4));
</txp:php>

You can add any txp tag inside the parse() and it will do it’s intended things.

And if you want to add attributes to the permlink tag, just use doublequtoes and not single ones.
Ex: parse('<p><txp:permlink class="theBodyTitle" />'.substr($thisarticle['body'],4));

Last edited by obeewan (2007-09-22 17:55:41)


Plugins: ob1_advanced_search 1.032b, ob1_search_score 1.0, ob1_pagination 2.5, ob1_title 4.1, ob1_modified 2.1

“Let your plans be dark and as impenetratable as night, and when you move, fall like a thunderbolt.”
— Sun Tzu

Offline

Board footer

Powered by FluxBB