Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-10-06 19:43:21

tydaikho
Member
From: VietNam
Registered: 2010-09-20
Posts: 16
Website

How can i add a class to list break tag?

I build a Category_list tag:

<txp:category_list active_class=“current” break=“li” class=“test” label=“Categories” labeltag=“h3” type=“article” wraptag=“ul” />

I get a category list output with <li> tag.
the output like:
<ul class=“test”>
<li>abc</li>
<li>abc</li>
<li>abc</li>
….

The “CSS class” property is only for <ul> tag. I want to asign <li> with a css class like <li class=“abc”> but i don’t see that property in tag builder tool. How can i do that? Pls help me… Thank you.

Last edited by tydaikho (2010-10-06 20:03:37)


http://vnsx.net | http://tydaikho.tk | http://txpblog.tk

Offline

#2 2010-10-06 19:55:04

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

Re: How can i add a class to list break tag?

See category_list on TextBook and take a look at the example number 3. According the guidelines it gives us:

<txp:category_list wraptag="ul" break="" class="test" label="Categories" labeltag="h3">
	<li class="<txp:if_category name='<txp:category />'>current<txp:else />abc</txp:if_category>">
		<txp:category title="1" link="1" />
	</li>
</txp:category_list>

Last edited by Gocom (2010-10-06 20:00:51)

Offline

#3 2010-10-06 20:13:58

tydaikho
Member
From: VietNam
Registered: 2010-09-20
Posts: 16
Website

Re: How can i add a class to list break tag?

Thank you for you quick rely… i try your example and the problem is fixed… ;) . I am not English country so i get troubles when i look for fixing my problem in manual docs. thanks again…
By the way, i want to ask some thing more?
Textpattern shows full article on frontpage (default). I want to show in my way, every article on frontpage will display introtext – not fulltext and my visitor click on Keep reading button to get full article. May i?


http://vnsx.net | http://tydaikho.tk | http://txpblog.tk

Offline

#4 2010-10-06 20:35:34

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: How can i add a class to list break tag?

In short: in your article form, replace <txp:body /> with something like this:

<txp:if_individual_article>
   <txp:body />
<txp:else />
   <txp:excerpt />
   <p><txp:permlink>Keep reading</txp:permlink></p>
</txp:if_individual_article>

Or this does the same:

<txp:if_article_list>
   <txp:excerpt />
   <p><txp:permlink>Keep reading</txp:permlink></p>
<txp:else />
   <txp:body />
</txp:if_article_list>

Here is a more extended FAQ about this: How do I show only an excerpt in article lists?

Offline

#5 2010-10-06 20:40:12

tydaikho
Member
From: VietNam
Registered: 2010-09-20
Posts: 16
Website

Re: How can i add a class to list break tag?

I see a pagination plugin on Textpattern resource but the download link is not actived more (http://textpattern.org/plugins/166/hfw_pg). I want show long article via multi page. May i? Thank you for your rely …

(pagination for article, not article list)

Last edited by tydaikho (2010-10-06 20:50:36)


http://vnsx.net | http://tydaikho.tk | http://txpblog.tk

Offline

#6 2010-10-06 21:02:37

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: How can i add a class to list break tag?

Maybe this one? http://textpattern.org/plugins/165/etz_pg.

It’s better to start a new topic if you have a new question ;)

Offline

#7 2010-10-06 21:09:33

tydaikho
Member
From: VietNam
Registered: 2010-09-20
Posts: 16
Website

Re: How can i add a class to list break tag?

Ok … i am afraid of being spammer ;) . Because i get many questions … Thank you… Good work. ;)

Last edited by tydaikho (2010-10-06 21:09:53)


http://vnsx.net | http://tydaikho.tk | http://txpblog.tk

Offline

#8 2010-10-06 22:00:29

tydaikho
Member
From: VietNam
Registered: 2010-09-20
Posts: 16
Website

Re: How can i add a class to list break tag?

Not fix. Here is my Homepage:

<div id=“left”>
<div class=“post”>

<txp:if_category> <h2><txp:category title=“1” /></h2>

<div class=“hfeed”> <txp:article form=“article_listing” limit=“5” /> </div>
<txp:else /> <txp:if_search> <h2><txp:text item=“search_results” />: <txp:page_url type=“q” /></h2>

<div class=“divider”><txp:image id=“1” /></div> </txp:if_search>

<div class=“hfeed”> <txp:article limit=“5” /> </div>
</txp:if_category>

<txp:if_individual_article> <div class=“divider”><txp:image id=“1” /></div>

<p><txp:link_to_prev>« <txp:prev_title /></txp:link_to_prev> <txp:link_to_next><txp:next_title /> »</txp:link_to_next></p>
<txp:else /> <p><txp:older>« <txp:text item=“older” /></txp:older> <txp:newer><txp:text item=“newer” /> »</txp:newer></p>
</txp:if_individual_article>

</div>
</div>

And my default form:

<txp:if_individual_article>
<h1 class=“entry-title”><txp:permlink><txp:title /></txp:permlink></h1>
<txp:else />
<h3 class=“entry-title”><txp:permlink><txp:title /></txp:permlink></h3>
</txp:if_individual_article>

<p class=“published”><txp:posted /></p>

<div class=“entry-content”>
<txp:body />
</div>

<address class=“vcard author”>— <span class=“fn”><txp:author /></span></address>

<p class=“tags”><txp:category1 title=“1” link=“1” />, <txp:category2 title=“1” link=“1” /></p>

<txp:comments_invite wraptag=“p” />

<div class=“divider”><txp:image id=“1” /></div>

I replace <txp:body /> with one of your way … my frontpage lists only title without any introtext… Pls help me …

Els wrote:

In short: in your article form, replace <txp:body /> with something like this:

<txp:if_individual_article>
   <txp:body />
<txp:else />
   <txp:excerpt />
   <p><txp:permlink>Keep reading</txp:permlink></p>
</txp:if_individual_article>

Or this does the same:

<txp:if_article_list>
   <txp:excerpt />
   <p><txp:permlink>Keep reading</txp:permlink></p>
<txp:else />
   <txp:body />
</txp:if_article_list>

Here is a more extended FAQ about this: How do I show only an excerpt in article lists?

Last edited by tydaikho (2010-10-06 22:01:11)


http://vnsx.net | http://tydaikho.tk | http://txpblog.tk

Offline

#9 2010-10-06 22:18:13

tydaikho
Member
From: VietNam
Registered: 2010-09-20
Posts: 16
Website

Re: How can i add a class to list break tag?

Sory for my TXP knowledge. Frontpage article will be fixed with excerpt. Writing introtext to excerpt form and bodytext to body form or using article_excerpts_homepage, i get things i need… Thanks TXP… ;)

Last edited by tydaikho (2010-10-06 22:46:31)


http://vnsx.net | http://tydaikho.tk | http://txpblog.tk

Offline

#10 2010-10-10 18:44:55

tydaikho
Member
From: VietNam
Registered: 2010-09-20
Posts: 16
Website

Re: How can i add a class to list break tag?

I convert some to TXP template, i get some troubles with TXP tag.
Here is my tag code:
<p><txp:rss_auto_excerpt words=“60” linkclass=“more float_r” linkwraptag=“a” ending=”&nbsp;…” /></p>

with my tag code, i want the output below:
<a class=“more float_r” href=“http://abc/~hoangnm/textpattern/index.php?id=1” rel=“bookmark”>Read More…</a>

But i get the out put like:
<a class=“more float_r”></a>
<a href=“http://abc/~hoangnm/textpattern/index.php?id=1” rel=“bookmark”>Read More…</a>

when i replace “a” with “p” in linkwraptag=“p” :
<p><txp:rss_auto_excerpt words=“60” linkclass=“more float_r” linkwraptag=“p” ending=”&nbsp;…” /></p>
i get the output:
<p class=“more float_r”><a href=“http://127.0.0.1/~hoangnm/textpattern/index.php?id=1” rel=“bookmark”>Read More…</a></p>
not <a class=“more float_r” href=”…”>Read more…</a>

I am newbie with TXP, so i don’t know how to fix it… Someone help me pls. Thank you.

Last edited by tydaikho (2010-10-10 18:52:41)


http://vnsx.net | http://tydaikho.tk | http://txpblog.tk

Offline

#11 2010-10-10 20:26:20

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: How can i add a class to list break tag?

tydaikho

  1. The plugin has a help text that is available as well in your Txp backend (Admin > Plugins) as here
  2. Questions about plugins are best posted in the plugin thread

That said, have a look at the showlinkwithexcerpt attribute, and the <txp:permlink> tag (hint: <txp:permlink class="more float_r">Read more</txp:permlink>).

Offline

#12 2010-10-10 20:32:55

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

Re: How can i add a class to list break tag?

I think you are doubling up the code with your attributes. The link itself will always be an “a” tag so there is no need to specify it in the “linkwraptag” however, by default, the “linkwraptag” will use “p” tags so just leave it blank to override this like so – linkwraptag="".

Also there is no need to use “p” tags around the plugin tag. The excerpt will contain it’s own formatting so you will end up with “p” tags inside “p” tags if you do what you have done.

Last edited by thebombsite (2010-10-10 20:36:21)


Stuart

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

Offline

#13 2010-10-10 20:55:32

tydaikho
Member
From: VietNam
Registered: 2010-09-20
Posts: 16
Website

Re: How can i add a class to list break tag?

Thank you for your rely!
@Els : i follow plugin help document that you suggest. I see:

linkwraptag
The HTML tag that wraps the permlink to the full article.
Default: “p”
Example: linkwraptag=“span”

linkclass
The class attribute on the linkwraptag.
Default: “”
Example: linkclass=“morelink”

But i don’t mention wraptag attribute. I mention to perm link “<a>” tag attribute ( class=”…”). Because i am using rss_auto_exerpt so i have to fix my mind with rss_auto_excerpt tag structure…
This is rss_auto_excerpt tag code:
<txp:rss_auto_excerpt words=“60” linkclass=“more float_r” linkwraptag=“” ending=”&nbsp;…” />
i think linkclass=“more float_r” only applies for linkwraptag.
So, i want to know the way to fix permlink of rss_auto_excerpt. Your example with default TXP permlink not rss_auto_excerpt readmore link.

@thebombsite: ok, i see, i can remove “<p>” tag before …
like below:
<txp:rss_auto_excerpt words=“60” linkclass=“more float_r” linkwraptag=“” ending=”&nbsp;…” />

the output is:
<a href=“http://link/~hoangnm/textpattern/index.php?id=1” rel=“bookmark”>Read More…</a>

no linkwraptag and linkclass applies nothing … I want the output may be :
<a href=“http://link/~hoangnm/textpattern/index.php?id=1” class=“more_float_r” rel=“bookmark”>Read More…</a>
it means [class=“more_float_r”] applies for pemlink (“<a>” tag), not permlink wraptag…

Last edited by tydaikho (2010-10-10 21:20:14)


http://vnsx.net | http://tydaikho.tk | http://txpblog.tk

Offline

#14 2010-10-10 21:31:19

tydaikho
Member
From: VietNam
Registered: 2010-09-20
Posts: 16
Website

Re: How can i add a class to list break tag?

Remove rss_auto_excerpt permlink and replace with default TXP permlink (<txp:permlink class=“more float_r”>Read more</txp:permlink>), i have fixed my problem… Thank you for your supporting. However, i still want to know how to assign “class” attribute to rss_auto_excerpt permlink. Because it is one of more situations i will see in future.


http://vnsx.net | http://tydaikho.tk | http://txpblog.tk

Offline

#15 2010-10-10 21:44:39

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: How can i add a class to list break tag?

tydaikho wrote:

However, i still want to know how to assign “class” attribute to rss_auto_excerpt permlink. Because it is one of more situations i will see in future.

I don’t think that is possible, other than using <txp:permlink> like you did now. From the plugin help:

linkclass
The class attribute on the linkwraptag.

So if linkwraptag is empty, no class will be assigned. But can’t you just style p.linkclass a or span.linkclass a?

Offline

Board footer

Powered by FluxBB