Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

new modifers - is there a word limit parameter? #1264

Closed
nick0 opened this issue Mar 1, 2017 · 7 comments
Closed

new modifers - is there a word limit parameter? #1264

nick0 opened this issue Mar 1, 2017 · 7 comments

Comments

@nick0
Copy link

nick0 commented Mar 1, 2017

Hello,
With the new modifiers, is there a "word limit" (eg 25 words) parameter to use in a ditto row template?
If so, how do I use it with the content variable?
[+content:word_limit=`25`+]??
Thanks

@modxuser
Copy link

modxuser commented Mar 2, 2017

I am not sure, but give this a try

[*content: summary (300)*]

Where 300 is the limit, if I am right, it strips the HTML itself

@yama is the best person to ask here

@nick0
Copy link
Author

nick0 commented Mar 2, 2017

Thanks for the help.
That one didn't work. I got empty output with + or with*
Thanks for the link - I also tried this without success:
[+content:Count_words(30)+]
Maybe I have got the syntax wrong?

@modxuser
Copy link

modxuser commented Mar 2, 2017

Strange - that should work - do you have modifiers activated in the config ?

If yes, then @yama will have to take a look, the code is there https://github.com/modxcms/evolution/blob/develop/manager/includes/extenders/modifiers.class.inc.php#L516

And the summary processor is here https://github.com/modxcms/evolution/blob/develop/manager/includes/extenders/modifiers/mdf_summary.inc.php

@nick0
Copy link
Author

nick0 commented Mar 2, 2017

Yes. Modifiers are activated (Enable Filters is yes) in the config and the PHx plugin has been deleted.

I can see the code in the links you sent but I don't know what to do with it.

Some comprehensive documentation on the modifiers listing all parameters, example usage etc would be handy. There are probably lots of little tricks that could be done with the modifiers but without examples its hard to know.

This is the call that worked for me in PHx - I am also wanting to strip all html tags...
[+content:word_limit=`25`:striptags+]

This is the replacement call I am currently trying without success in the new modifiers...
[+content:Count_words(30)+]

The full call in the ditto row template is like so...
[+content:isnot=``:then=`<p>[+content:Count_words(30)+] <span class="more"><a href="[~[+id+]~]" title="read more">more</a></span></p>`+]

Thanks for your help @modxuser.

I will wait for @yama.

@Deesen
Copy link
Contributor

Deesen commented Mar 3, 2017

There is also a snippet, maybe it helps for the time being https://github.com/AgelxNash/DocLister/tree/master/assets/snippets/summary .

Or maybe just disable modifiers and use latest PHX ?

@nick0
Copy link
Author

nick0 commented Mar 3, 2017

Thanks @Deesen. That is good to know re the summary snippet. I would use that as a last resort but keen to see if the new modifiers can do it natively.

It works fine me in PHx and has for many years. I am just wanting to know how to do it with the new modifiers. This makes me want to stick with PHx :) PHx is a proven performer but I am trying out the modifiers. Hopefully it can be done so its easy to update in existing ditto row templates.

The problem with the doc parser issue and the new modifiers and PHx is that the combinations seem to work for me in some scenarios and not in others (like in that demo site you looked at for me where the Modifiers had to be used instead of PHX).

Cheers again.

@modxuser
Copy link

modxuser commented Mar 3, 2017

@yama any chance of you looking at this problem please ?

I am also trying to convert tags from "IF", but if the built-in modifiers don't work properly I see no point in having them in the system, at least, not until they work properly

The discussion about PHx, IF and Built-In modifiers (#1238) would also be resolved, at least until the built-in modifiers are 100% compatible

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants