Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Splitting long text for Template

by choroba (Archbishop)
on Feb 07, 2021 at 23:54 UTC ( #11128039=note: print w/replies, xml ) Need Help??


in reply to Re: Splitting long text for Template
in thread Splitting long text for Template

> you could probably use simple conditional IF blocks in the template

I fully agree. Especially if you want to hide the rest of the text for a purpose, e.g. show the full text only to the paying customers. Hiding it via JavaScript would still make them have the full text at their disposal. The distinction of a paying/not paying customer is definitely not part of the View's business.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^3: Splitting long text for Template
by LanX (Cardinal) on Feb 08, 2021 at 00:06 UTC
    > The distinction of a paying/not paying customer is definitely not part of the View's business.

    But that's another use case, which would affect the Model too, cause you'd need a table customer for a paywall scenario.

    The OP said "if the text is too long"

    This can also depend on the output media is it ...

    • a large desktop browser?
    • a mobile?
    • for print?
    • ...

    Clearly presentation!

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Re^3: Splitting long text for Template
by Bod (Hermit) on Feb 08, 2021 at 00:12 UTC
    Especially if you want to hide the rest of the text for a purpose, e.g. show the full text only to the paying customers.

    I hadn't even considered that as a possibility! In this case, it is only to keep the amount of text short enough to get lots of entries on a page. The user can expand any they for which they want further information.

    So, something like [% IF text.length > 150 %] - I can't see how to ensure the text is split on a word boundary with a simple IF condition.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11128039]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2021-04-11 22:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?