2

I'm trying to find the right way of adjusting the topic title length displayed on the topic listing page generated by Advanced Forum (mysite.com/forum/[myforum]).

I tried to manipulate the title variable offered by the template-advanced-forum.naked.topic-list-view.tpl.php and the corresponding theme function but it gives me formatted HTML like this:

<a href="/debatindlaeg/lorem-ipsum-lorem-ipsum-lorem-ipsum-lorem-ipsum-lorem-ipsum-lorem-ipsum-lorem-ipsum" title=" lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum  lorem ipsum lorem ipsum lorem ipsum lorem ipsum   "><span class="forum-topic-title">Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum </span> </a> <br /> by <span class="username" xml:lang="" typeof="sioc:UserAccount" property="foaf:name">Anonym</span> » ons, 18/01/2012 - 17:05

My guess is that I need to go "further back" in the theming process somehow to get a hold of the title variable, but I must admit this is beyond my Drupal skills. Any suggestions?

I am using D7 and Advanced Forum (version 7.x-2.0-beta1).

1

Not sure if this is exactly what you're looking for, but Advanced Forum integrates itself with Views.

So (assuming you have the Views module), you can trim the length of the title field in the advanced_forum_topic_list view. This c done by clicking the Content: Title (Topic / Topic starter) field, going to 'Rewrite results' and checking 'Trim this field to a maximum length'.

Because the field contains HTML to insert a span tag, you'll have to add 32 to the trim count (e.g. if you want to trim to 20 chars, enter 52), and ensure 'Field can contain HTML' is checked.

| improve this answer | |
  • Yes yes yes exactly what I was looking for - hadn't noticed the Views integration, that makes perfect sense, once you see it. Thanks! – benjamin_dk Jan 23 '12 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.