lundi 7 septembre 2020

How to Display Limit Content When Content has Html Tag

Hello I have a content

Sail under the iconic Tower Bridge and enjoy spectacular river views of London’s most famous landmarks with the MBNA Thames Clippers. Select from a choice of three different ticket options. With freedom to hop on and off at any of the 17 piers in the Central and East Zones, the River Roamer Ticket is ideal for a day of sightseeing in London. Single and return tickets are also available to purchase, perfect for travelling in comfort and style from A to B.

I want to apply Read more I am using like

@if(strlen($products_data->longDesc)>1000)
    {!! nl2br(substr($products_data->longDesc,0,100)) !!}
    <span class="moreellipses" style="display: inline;">...&nbsp;</span>
    <span class="more-text" style="display: none;">{!! nl2br(substr($products_data->longDesc,100)) !!}</span>
    <a class="read_more_text" href="javascript:void(0)">Read more</a>
    <a class="read_less_text hide" href="javascript:void(0)">Read less</a>
@else
    {!! nl2br($products_data->longDesc) !!}
@endif
                                

But some time i am facing issue with this function substr($products_data->longDesc,0,100) it give me string without close tag like <stro and then my site layout create problem how to manage read more with html tag



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire