0

I'm trying to transform a string returned by a function with HTML attributes. I cannot edit this function because it is in a class in the vendor directory.

So this is my string :

$content = '
<span class="em-pagination">
    <strong>
        <span class="page-numbers current">1</span>
    </strong>
    <a class="page-numbers" href="url/?p=2" title="2">2</a>
    <a class="next page-numbers" href="/url/?p=2" title="2">&gt;</a>
</span>';

My string has to be like this :

$output = '
<div class="basic-pagination mt-10 text-center">
    <ul>
        <li class="active"><a href="url">01</a></li>
        <li><a href="url/?p=2/">2</a></li>
        <li><a href="url/?p=2/"><i class="fas fa-angle-double-right"></i></a></li>
    </ul>
</div>

I have tried doing replacements with preg_replace()and regular expressions but with no success.

It would be great if you could help me.

Thank you very much

0 Answers0