Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2007-07-27 13:51:57
- fas.khan
- Member
- From: Paris
- Registered: 2007-06-06
- Posts: 41
<txp:title /> Title Trim ...
Hello all,
I am into this problem where I want to trim the Title (<txp:title />) length and put (…) at the end. It seems that this ‘sab_substr’ plugin can do the job, but I really dion’t know where to get this plugin.
The author of the site www.bluecamel.org is not working anymore and that is where this plugin is located.
Can I anyone suggest me where to get this plugin or any other way how to accomplish it ?
Thanks.
Offline
#2 2007-07-27 23:02:49
- fas.khan
- Member
- From: Paris
- Registered: 2007-06-06
- Posts: 41
Re: <txp:title /> Title Trim ...
Any help, any one ? pleaaase :(
Offline
Re: <txp:title /> Title Trim ...
See here
Offline
#4 2007-07-28 14:26:59
- fas.khan
- Member
- From: Paris
- Registered: 2007-06-06
- Posts: 41
Re: <txp:title /> Title Trim ...
Hello,
I am so so thankful to you that you put this code here … I am a TUDelft Student and making a blog site for my Masters Program.
I am so sorry but I couldn’t implement your code … I am writing the lines the way I used my code …
I am showing the title of posts in a list and want the title to be trimmed from your function.
CODE
————
<ul class=“articles”>
<txp:php>
// your code
function sab_substr($atts, $thing)
{
extract(lAtts(array(
‘limit’ => 30,
‘trail’ => ‘…’
), $atts));
</txp:php>
// your code ends here
<txp:article_custom section=“article” limit=“5” form=“recent_articles_list” />
</ul>
The Form (recent_articles_list ) is as follows:-
—————————————————————————————-
<li>
<a href=”<txp:permlink />” title=”<txp:title />”>
<txp:sab_substr><txp:title /></txp:sab_substr><br>
</a>
</li>
I put the limit of five article titles to be shown … and what happens is that that <li> becomes empty as there is nothing inside it …
——————————————————————————————————————————————————————————————————————————————
and <txp:title /> is repeated five times on the top of the page …
———————————————————————————————————————
Just like this
<txp:title /><txp:title /><txp:title /><txp:title /><txp:title />
I would be very thankful for your help.
Regards,
Faisal
Last edited by fas.khan (2007-07-28 14:43:11)
Offline
Re: <txp:title /> Title Trim ...
Ah, I’ve updated the code in the other topic. The ‘parse($thing)’ line was missing. This ex-TUEindhoven student doesn’t always test his code before publishing it on forums ;)
Btw, if 30 chars is too long, use something like <txp:sab_substr limit="20"><txp:title /></txp:sab_substr>
Last edited by ruud (2007-07-28 14:53:33)
Offline
#6 2007-07-28 17:36:37
- fas.khan
- Member
- From: Paris
- Registered: 2007-06-06
- Posts: 41
Re: <txp:title /> Title Trim ...
It is fine … but one of the two problems are solved …
The first problem was that it shows <txp:title /> all the way … in every title … but now It shows it perfectly …
The second problem was that it shows the Titles way way up left the page … instead of showing inside of <li> …
which is still there … I don’t know what is the problem here but may be you know … i attach the picture to show you better what I mean …
I put the picture here …
http://www.epastudents.org/img/up/test.png
It is suppose to come at red boxes … but it it coming to blue box …
Regards,
Faisal Khan
Offline
Re: <txp:title /> Title Trim ...
Oops, try replacing echo
with return
in the code. The code in the other example is updated again.
Last edited by ruud (2007-07-28 17:46:33)
Offline
#8 2007-07-29 13:11:27
- fas.khan
- Member
- From: Paris
- Registered: 2007-06-06
- Posts: 41
Re: <txp:title /> Title Trim ...
still the same problem Ruud … :(
I am so sorry :(
Offline
Re: <txp:title /> Title Trim ...
Strange. Oh well, let’s turn it into a real plugin then. That should definitely work (and it’s easier to use anyway). You can get it here
Offline
#10 2007-07-29 14:49:00
- fas.khan
- Member
- From: Paris
- Registered: 2007-06-06
- Posts: 41
Re: <txp:title /> Title Trim ...
Whoa …
Now this is the way Dutch Bell the Cats … :-)
Done ! …
Thank you so so much …
Offline
Pages: 1